ella_common::ops

Trait TensorOp

Source
pub trait TensorOp<Rhs: TensorValue>: TensorValue {
    type Output<Out>;

    // Required method
    fn apply<F, O>(self, other: Rhs, op: F) -> Self::Output<O>
       where F: Fn(Self::Unmasked, Rhs::Unmasked) -> O,
             O: TensorValue,
             Self::Output<O>: TensorValue;
}

Required Associated Types§

Source

type Output<Out>

Required Methods§

Source

fn apply<F, O>(self, other: Rhs, op: F) -> Self::Output<O>
where F: Fn(Self::Unmasked, Rhs::Unmasked) -> O, O: TensorValue, Self::Output<O>: TensorValue,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> TensorOp<Option<T>> for Option<T>
where T: TensorValue<Unmasked = T, Masked = Option<T>>, Option<T>: TensorValue<Unmasked = T>,

Source§

type Output<Out> = Option<Out>

Source§

fn apply<F, O>(self, other: Option<T>, op: F) -> Self::Output<O>
where F: Fn(Self::Unmasked, <Option<T> as TensorValue>::Unmasked) -> O, O: TensorValue, Self::Output<O>: TensorValue,

Source§

impl<T> TensorOp<T> for Option<T>
where T: TensorValue<Unmasked = T, Masked = Option<T>>, Option<T>: TensorValue<Unmasked = T>,

Source§

type Output<Out> = Option<Out>

Source§

fn apply<F, O>(self, other: T, op: F) -> Self::Output<O>
where F: Fn(Self::Unmasked, <T as TensorValue>::Unmasked) -> O, O: TensorValue, Self::Output<O>: TensorValue,

Implementors§

Source§

impl<T> TensorOp<Option<T>> for T
where T: TensorValue<Unmasked = T, Masked = Option<T>>, Option<T>: TensorValue<Unmasked = T>,

Source§

type Output<Out> = Option<Out>

Source§

impl<T> TensorOp<T> for T
where T: TensorValue<Unmasked = Self>,

Source§

type Output<Out> = Out