pub trait Layer<S, D>{
    type Scalar;
    // Required methods
    fn params(&self) -> &ParamsBase<S, D>;
    fn params_mut(&mut self) -> &mut ParamsBase<S, D>;
    // Provided methods
    fn set_params(&mut self, params: ParamsBase<S, D>) { ... }
    fn backward<X, Y, Z, Delta>(
        &mut self,
        input: X,
        error: Y,
        gamma: Self::Scalar,
    ) -> Result<Z>
       where S: Data,
             Self: ActivateGradient<Y, Delta = Delta>,
             Self::Scalar: Clone,
             ParamsBase<S, D>: Backward<X, Delta, Elem = Self::Scalar, Output = Z> { ... }
    fn forward<X, Y>(&self, input: &X) -> Result<Y>
       where Y: Tensor<S, D, Scalar = Self::Scalar>,
             ParamsBase<S, D>: Forward<X, Output = Y>,
             Self: Activate<Y, Output = Y> { ... }
}Expand description
A layer within a neural-network containing a set of parameters and an activation function. Here, this manifests as a wrapper around the parameters of the layer with a generic activation function and corresponding traits to denote desired behaviors.
Required Associated Types§
Required Methods§
Sourcefn params(&self) -> &ParamsBase<S, D>
 
fn params(&self) -> &ParamsBase<S, D>
returns an immutable reference to the parameters of the layer
Sourcefn params_mut(&mut self) -> &mut ParamsBase<S, D>
 
fn params_mut(&mut self) -> &mut ParamsBase<S, D>
returns a mutable reference to the parameters of the layer
Provided Methods§
Sourcefn set_params(&mut self, params: ParamsBase<S, D>)
 
fn set_params(&mut self, params: ParamsBase<S, D>)
update the layer parameters
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.