[]Struct tract_onnx::prelude::ShapeFact

pub struct ShapeFact {
    pub stream_info: Option<StreamFact>,
    // some fields omitted
}

Fully determined dimension of a tensor.

Tensors in tract can have one streaming dimension. TDim generalize the regular tensor dimensions (usize) to arithmetic expressions of S, the (sometimes hypothetical) tensor length on the streaming axis.

Fields

stream_info: Option<StreamFact>

Optional information for streaming tensors. None for regular tensors.

Implementations

impl ShapeFact

pub fn rank(&self) -> usize

Rank of the tensor.

pub fn dim(&self, i: usize) -> TDim

Extended dimension of the i-th axis.

The TDim will wrap a plain integer for regular (non-streaming) tensors.

pub fn set_dim(&mut self, i: usize, dim: TDim) -> Result<(), TractError>

Set the i-th axis dimension.

pub fn insert_axis(&mut self, axis: usize) -> Result<(), TractError>

pub fn remove_axis(&mut self, axis: usize) -> Result<(), TractError>

pub fn as_finite(&self) -> Option<&[usize]>

Shape of the tensor, unless it is streaming.

pub fn iter(&'a self) -> impl Iterator<Item = TDim> + 'a

Iterator over dimension of the shape.

pub fn to_tvec(&self) -> SmallVec<[TDim; 4]>

Convert the shape to an array of extended dimensions.

pub fn from_dims<T>(it: T) -> Result<ShapeFact, TractError> where
    T: AsRef<[TDim]> + Debug

Trait Implementations

impl Clone for ShapeFact

impl Debug for ShapeFact

impl Hash for ShapeFact

impl PartialEq<ShapeFact> for ShapeFact

impl<'_> TryFrom<&'_ [TDim]> for ShapeFact

type Error = TractError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ [usize]> for ShapeFact

type Error = TractError

The type returned in the event of a conversion error.

impl TryFrom<()> for ShapeFact

type Error = TractError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.