[−][src]Struct tract_core::tensor::Tensor
Tensor is a concrete tensor in tract.
Methods
impl Tensor
[src]
pub unsafe fn uninitialized_aligned<T: Datum>(
shape: &[usize],
alignment: usize
) -> TractResult<Tensor>
[src]
shape: &[usize],
alignment: usize
) -> TractResult<Tensor>
Create an uninitialized tensor with a given alignment (in bytes).
pub unsafe fn from_raw<T: Datum>(
shape: &[usize],
content: &[u8]
) -> TractResult<Tensor>
[src]
shape: &[usize],
content: &[u8]
) -> TractResult<Tensor>
Create an tensor from raw data.
It copies the data, aligning it to the size of T.
pub fn into_aligned(self, alignment: usize) -> TractResult<Tensor>
[src]
Re-align a tensor to a byte alignment.
pub unsafe fn null<T: Datum>(shape: &[usize]) -> TractResult<Tensor>
[src]
Creates a null tensor (this is rare, and should stay that way).
pub unsafe fn null_dt(dt: DatumType, shape: &[usize]) -> TractResult<Tensor>
[src]
Creates a null tensor (this is rare, and should stay that way).
pub fn is_null(&self) -> bool
[src]
Check weather self is a null tensor.
pub fn shape(&self) -> &[usize]
[src]
Get the shape of the tensor.
pub unsafe fn into_shape(self, shape: &[usize]) -> TractResult<Tensor>
[src]
Reshape the tensor to shape
.
pub fn datum_type(&self) -> DatumType
[src]
Get the datum type of the tensor.
pub fn dump_t<D: Datum>(&self, force_full: bool) -> TractResult<String>
[src]
Dump the tensor in a human readable form.
force_full
will force the tensor to be dump in full even if it is big.
pub fn dump(&self, force_full: bool) -> TractResult<String>
[src]
Dump the tensor in a human readable form.
force_full
will force the tensor to be dump in full even if it is big.
pub fn close_enough(&self, other: &Self, approx: bool) -> bool
[src]
Compare two tensors, allowing for rounding errors.
pub fn into_array<D: Datum>(self) -> TractResult<ArrayD<D>>
[src]
Transform the tensor into a ndarray::Array
.
pub fn to_array_view<'a, D: Datum>(&'a self) -> TractResult<ArrayViewD<'a, D>>
[src]
Transform the data as a ndarray::Array
.
pub fn to_array_view_mut<'a, D: Datum>(
&'a mut self
) -> TractResult<ArrayViewMutD<'a, D>>
[src]
&'a mut self
) -> TractResult<ArrayViewMutD<'a, D>>
Transform the data as a mutable ndarray::Array
.
pub fn as_ptr<D: Datum>(&self) -> TractResult<*const D>
[src]
Access the data as a pointer.
pub fn as_ptr_mut<D: Datum>(&mut self) -> TractResult<*mut D>
[src]
Access the data as a mutable pointer.
pub fn as_slice<D: Datum>(&self) -> TractResult<&[D]>
[src]
Access the data as a slice.
pub fn as_slice_mut<D: Datum>(&mut self) -> TractResult<&mut [D]>
[src]
Access the data as a mutable slice.
pub fn to_scalar<'a, D: Datum>(&'a self) -> TractResult<&D>
[src]
Access the data as a scalar.
pub fn cast_to<D: Datum>(&self) -> TractResult<Cow<Tensor>>
[src]
Optionnaly convert data to a tensor for a new DatumType.
pub fn cast_to_dt(&self, dt: DatumType) -> TractResult<Cow<Tensor>>
[src]
Optionnaly convert data to a tensor for a new DatumType.
Trait Implementations
impl IntoArcTensor for Tensor
[src]
fn into_arc_tensor(self) -> Arc<Tensor>
[src]
impl PartialEq<Tensor> for Tensor
[src]
fn eq(&self, other: &Tensor) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for Tensor
[src]
impl Clone for Tensor
[src]
fn clone(&self) -> Tensor
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<bool> for Tensor
[src]
impl From<f16> for Tensor
[src]
impl From<f32> for Tensor
[src]
impl From<f64> for Tensor
[src]
impl From<i8> for Tensor
[src]
impl From<i16> for Tensor
[src]
impl From<i32> for Tensor
[src]
impl From<i64> for Tensor
[src]
impl From<u8> for Tensor
[src]
impl From<u16> for Tensor
[src]
impl From<TDim> for Tensor
[src]
impl From<String> for Tensor
[src]
impl From<Tensor> for TypedTensorInfo
[src]
fn from(t: Tensor) -> TypedTensorInfo
[src]
impl<'t> From<&'t Tensor> for TypedTensorInfo
[src]
fn from(t: &'t Tensor) -> TypedTensorInfo
[src]
impl<D: Dimension, T: Datum> From<ArrayBase<OwnedRepr<T>, D>> for Tensor
[src]
impl Debug for Tensor
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> Clone for T where
T: Clone,
[src]
T: Clone,