Trait rai_core::Func

source ·
pub trait Func<IN, OUT>
where IN: WithTensors, OUT: WithTensors,
{ type Tangent: ToTensorGrads + FromTensorGrads; type Cotangent: ToTensorGrads + FromTensorGrads; // Required methods fn call(&self, input: IN) -> OUT; fn extract_input_tensors(&self, input: &IN, tensors: &mut Vec<Tensor>); // Provided method fn self_captured_tensors(&self, _tensors: &mut Vec<Tensor>) { ... } }

Required Associated Types§

Required Methods§

source

fn call(&self, input: IN) -> OUT

source

fn extract_input_tensors(&self, input: &IN, tensors: &mut Vec<Tensor>)

Provided Methods§

source

fn self_captured_tensors(&self, _tensors: &mut Vec<Tensor>)

Implementors§

source§

impl<'m, 'i, 'l, M, F> Func<(&'m M, &'i Tensor, &'l Tensor), Tensor> for F
where M: Module, F: Fn(&'m M, &'i Tensor, &'l Tensor) -> Tensor,

source§

impl<'m, 'i, 'l, M, F, T> Func<(&'m M, &'i Tensor, &'l Tensor), (Tensor, Aux<T>)> for F
where M: Module, F: Fn(&'m M, &'i Tensor, &'l Tensor) -> (Tensor, Aux<T>),

source§

impl<'m, 'i, M, F> Func<(&'m M, &'i Tensor), Tensor> for F
where M: Module, F: Fn(&'m M, &'i Tensor) -> Tensor,

source§

impl<'m, 'i, M, F, T> Func<(&'m M, &'i Tensor), (Tensor, Aux<T>)> for F
where M: Module, F: Fn(&'m M, &'i Tensor) -> (Tensor, Aux<T>),

source§

impl<F> Func<[Tensor; 1], [Tensor; 1]> for F
where F: Fn(&Tensor) -> Tensor,

§

type Tangent = [Tensor; 1]

§

type Cotangent = [Tensor; 1]

source§

impl<F> Func<[Tensor; 2], [Tensor; 1]> for F
where F: Fn(&Tensor, &Tensor) -> Tensor,

§

type Tangent = [Tensor; 2]

§

type Cotangent = [Tensor; 1]

source§

impl<F> Func<[Tensor; 3], [Tensor; 1]> for F
where F: Fn(&Tensor, &Tensor, &Tensor) -> Tensor,

§

type Tangent = [Tensor; 3]

§

type Cotangent = [Tensor; 1]

source§

impl<T> Func<Tensor, Tensor> for T
where T: Module,