pub trait Primitive: Debug {
    // Required methods
    fn clone_boxed(&self) -> Box<dyn Primitive>;
    fn as_any(&self) -> &dyn Any;
    fn jvp(
        &self,
        output: &Tensor,
        primals: &[Tensor],
        tangents: &[Tensor]
    ) -> Tensor;
    fn vjp(
        &self,
        output: &Tensor,
        primals: &[Tensor],
        cotangent: &Tensor
    ) -> Vec<Tensor>;

    // Provided method
    fn dot_label(&self) -> String { ... }
}

Required Methods§

source

fn clone_boxed(&self) -> Box<dyn Primitive>

source

fn as_any(&self) -> &dyn Any

source

fn jvp( &self, output: &Tensor, primals: &[Tensor], tangents: &[Tensor] ) -> Tensor

source

fn vjp( &self, output: &Tensor, primals: &[Tensor], cotangent: &Tensor ) -> Vec<Tensor>

Provided Methods§

source

fn dot_label(&self) -> String

Trait Implementations§

source§

impl Clone for Box<dyn Primitive>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B, P> Eval<dyn Backend, dyn Primitive> for Dispatch<B, P>
where B: Backend + 'static + Sync + Send, P: Primitive + 'static + Sync + Send, Self: Eval<B, P> + 'static,

source§

fn eval( &self, backend: &dyn Backend, primitive: &dyn Primitive, inputs: &[Tensor], output: &Tensor )

source§

impl<'a> From<&'a dyn Primitive> for Box<dyn Primitive>

source§

fn from(t: &'a dyn Primitive) -> Self

Converts to this type from the input type.
source§

impl<T> From<T> for Box<dyn Primitive>
where T: Clone + Primitive + 'static,

source§

fn from(t: T) -> Self

Converts to this type from the input type.

Implementors§