Trait tract_pulse::internal::DimLike[]

pub trait DimLike: 'static + Clone + Default + PartialEq<Self> + From<usize> + for<'a> TryFrom<&'a TDim, Error = Error> + Zero<Output = Self, Output = Self, Output = Self> + Debug + Display + Hash + Add<Self> + Add<usize> + for<'a> Add<&'a Self> + Sub<Self, Output = Self, Output = Self, Output = Self> + Sub<usize> + for<'a> Sub<&'a Self> + Mul<usize, Output = Self> + Div<usize, Output = Self> + Rem<usize, Output = Self> + Send + Sync + Sum<Self> + ToDim {
    fn maybe_div(&self, other: &Self) -> Result<(Self, u64), Error>;
fn maybe_mul(&self, other: &Self) -> Result<Self, Error>;
fn to_i64(&self) -> Result<i64, Error>;
fn one() -> Self;
fn eval(&self, values: &SymbolValues) -> Self; fn div_ceil(&self, other: usize) -> Self { ... }
fn to_usize(&self) -> Result<usize, Error> { ... }
fn to_isize(&self) -> Result<isize, Error> { ... }
fn to_i32(&self) -> Result<i32, Error> { ... } }
Expand description

A super-trait for value acting as tensor dimensions in tract.

Implemented by:

  • usize for regular dimensions
  • TDim supporting regular and streaming dimensions

Required methods

fn maybe_div(&self, other: &Self) -> Result<(Self, u64), Error>

fn maybe_mul(&self, other: &Self) -> Result<Self, Error>

fn to_i64(&self) -> Result<i64, Error>

Expand description

Convert to regular integer.

fn one() -> Self

Expand description

do not use num_traits::Mul as it implies a regular Mul

fn eval(&self, values: &SymbolValues) -> Self

Provided methods

fn div_ceil(&self, other: usize) -> Self

Expand description

Integer divise, rounding up to next integer.

fn to_usize(&self) -> Result<usize, Error>

fn to_isize(&self) -> Result<isize, Error>

fn to_i32(&self) -> Result<i32, Error>

Implementations on Foreign Types

impl DimLike for usize

pub fn maybe_mul(&self, other: &usize) -> Result<usize, Error>

pub fn maybe_div(&self, other: &usize) -> Result<(usize, u64), Error>

pub fn to_i64(&self) -> Result<i64, Error>

pub fn one() -> usize

pub fn eval(&self, _values: &SymbolValues) -> usize

Implementors

impl DimLike for TDim

pub fn maybe_div(&self, other: &TDim) -> Result<(TDim, u64), Error>

pub fn maybe_mul(&self, other: &TDim) -> Result<TDim, Error>

pub fn to_i64(&self) -> Result<i64, Error>

pub fn one() -> TDim

pub fn eval(&self, values: &SymbolValues) -> TDim