[][src]Struct tract_core::tensor::Tensor

pub struct Tensor { /* fields omitted */ }

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]

Create an uninitialized tensor with a given alignment (in bytes).

pub unsafe fn from_raw<T: Datum>(
    shape: &[usize],
    content: &[u8]
) -> TractResult<Tensor>
[src]

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]

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]

impl PartialEq<Tensor> for Tensor[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_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]

impl<'t> From<&'t Tensor> for TypedTensorInfo[src]

impl<D: Dimension, T: Datum> From<ArrayBase<OwnedRepr<T>, D>> for Tensor[src]

impl Debug for Tensor[src]

Auto Trait Implementations

impl Send for Tensor

impl Sync for Tensor

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> Clone for T where
    T: Clone
[src]