Skip to main content

Operators

Trait Operators 

Source
pub trait Operators {
    type Elem;

    // Required methods
    fn arg_max(
        &self,
        axis: isize,
        keep_dims: bool,
    ) -> Result<Tensor<i32>, OpError>
       where Self::Elem: Copy + PartialOrd + IsNaN;
    fn div(
        &self,
        other: TensorView<'_, Self::Elem>,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + Debug + Default + PartialEq + Mul<Output = Self::Elem> + Div<Output = Self::Elem> + IsInt + Identities;
    fn mul(
        &self,
        other: TensorView<'_, Self::Elem>,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + Debug + Default + Mul<Output = Self::Elem>;
    fn reduce_max(
        &self,
        axes: Option<&[i32]>,
        keep_dims: bool,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + PartialOrd + IsNaN + MinMax;
    fn reduce_min(
        &self,
        axes: Option<&[i32]>,
        keep_dims: bool,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + PartialOrd + IsNaN + MinMax;
    fn reduce_sum(
        &self,
        axes: Option<&[i32]>,
        keep_dims: bool,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + Default + Add<Self::Elem, Output = Self::Elem>;
    fn pad(
        &self,
        padding: NdTensorView<'_, i32, 1>,
        val: Self::Elem,
    ) -> Result<Tensor<Self::Elem>, OpError>
       where Self::Elem: Copy + Default + PartialEq;
    fn topk(
        &self,
        k: usize,
        axis: Option<isize>,
        largest: bool,
        sorted: bool,
    ) -> Result<(Tensor<Self::Elem>, Tensor<i32>), OpError>
       where Self::Elem: Copy + Default + PartialOrd + IsNaN;
}
Expand description

Trait which exposes ONNX operators as methods of tensors.

This trait provides methods which are available on all tensor types. See FloatOperators for additional operators which are only available on float tensors.

Required Associated Types§

Required Methods§

Source

fn arg_max(&self, axis: isize, keep_dims: bool) -> Result<Tensor<i32>, OpError>
where Self::Elem: Copy + PartialOrd + IsNaN,

Source

fn div( &self, other: TensorView<'_, Self::Elem>, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Debug + Default + PartialEq + Mul<Output = Self::Elem> + Div<Output = Self::Elem> + IsInt + Identities,

Source

fn mul( &self, other: TensorView<'_, Self::Elem>, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Debug + Default + Mul<Output = Self::Elem>,

Source

fn reduce_max( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + PartialOrd + IsNaN + MinMax,

Source

fn reduce_min( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + PartialOrd + IsNaN + MinMax,

Source

fn reduce_sum( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Default + Add<Self::Elem, Output = Self::Elem>,

Source

fn pad( &self, padding: NdTensorView<'_, i32, 1>, val: Self::Elem, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Default + PartialEq,

Source

fn topk( &self, k: usize, axis: Option<isize>, largest: bool, sorted: bool, ) -> Result<(Tensor<Self::Elem>, Tensor<i32>), OpError>
where Self::Elem: Copy + Default + PartialOrd + IsNaN,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Send, S: Storage<Elem = T> + Sync, L: Layout + Clone + Sync> Operators for TensorBase<S, L>

Source§

type Elem = T

Source§

fn arg_max(&self, axis: isize, keep_dims: bool) -> Result<Tensor<i32>, OpError>
where T: Copy + PartialOrd + IsNaN,

Source§

fn div( &self, other: TensorView<'_, Self::Elem>, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Debug + Default + PartialEq + Mul<Output = Self::Elem> + Div<Output = Self::Elem> + IsInt + Identities,

Source§

fn mul(&self, other: TensorView<'_, T>) -> Result<Tensor<T>, OpError>
where T: Copy + Debug + Default + Mul<Output = T>,

Source§

fn reduce_max( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<T>, OpError>
where T: Copy + PartialOrd + IsNaN + MinMax,

Source§

fn reduce_min( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<T>, OpError>
where T: Copy + PartialOrd + IsNaN + MinMax,

Source§

fn reduce_sum( &self, axes: Option<&[i32]>, keep_dims: bool, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Default + Add<Self::Elem, Output = Self::Elem>,

Source§

fn pad( &self, padding: NdTensorView<'_, i32, 1>, val: T, ) -> Result<Tensor<Self::Elem>, OpError>
where Self::Elem: Copy + Default + PartialEq,

Source§

fn topk( &self, k: usize, axis: Option<isize>, largest: bool, sorted: bool, ) -> Result<(Tensor<Self::Elem>, Tensor<i32>), OpError>
where T: Copy + Default + PartialOrd + IsNaN,

Implementors§