ActivationOps

Trait ActivationOps 

Source
pub trait ActivationOps<T, S: Shape = (), D: Device = Self>: Device {
    // Required methods
    fn sigmoid(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn sigmoid_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn tanh(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn tanh_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn relu(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn relu_mut(&self, x: &mut Matrix<'_, T, D, S>);
    fn relu_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>;
    fn relu_grad_mut(&self, x: &mut Matrix<'_, T, D, S>);
}

Required Methods§

Source

fn sigmoid(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn sigmoid_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn tanh(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn tanh_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn relu(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn relu_mut(&self, x: &mut Matrix<'_, T, D, S>)

inplace

Source

fn relu_grad(&self, x: &Matrix<'_, T, D, S>) -> Matrix<'_, T, Self, S>

Source

fn relu_grad_mut(&self, x: &mut Matrix<'_, T, D, S>)

inplace

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.

Implementors§

Source§

impl<T: Float, D: MainMemory, S: Shape> ActivationOps<T, S, D> for CPU

Available on crate feature cpu only.
Source§

impl<T: CDatatype + Float> ActivationOps<T> for OpenCL

Available on crate feature opencl only.