Trait collenchyma_nn::TanhPointwise [] [src]

pub trait TanhPointwise<F>: NN<F> {
    fn tanh_pointwise(&self, x: &mut SharedTensor<F>) -> Result<(), Error>;
    fn tanh_pointwise_plain(&self, x: &mut SharedTensor<F>) -> Result<(), Error>;
    fn tanh_pointwise_grad(&self, x: &mut SharedTensor<F>, x_diff: &mut SharedTensor<F>) -> Result<(), Error>;
    fn tanh_pointwise_grad_plain(&self, x: &SharedTensor<F>, x_diff: &mut SharedTensor<F>) -> Result<(), Error>;
}

Provides the functionality for pointwise ReLU operations (overwrites the input with the result of the operation).

Required Methods

fn tanh_pointwise(&self, x: &mut SharedTensor<F>) -> Result<(), Error>

Computes the hyperbolic Tangent over the input Tensor x with complete memory management.

Saves the result back to x.

For a no-memory managed version see tanh_pointwise_plain.

fn tanh_pointwise_plain(&self, x: &mut SharedTensor<F>) -> Result<(), Error>

Computes the tanh over the input Tensor x without any memory management.

Saves the result back to x.

Attention:
For a correct computation result, you need to manage the memory allocation and synchronization yourself.
For a memory managed version see tanh_pointwise.

fn tanh_pointwise_grad(&self, x: &mut SharedTensor<F>, x_diff: &mut SharedTensor<F>) -> Result<(), Error>

Computes the gradient of tanh over the input Tensor x with complete memory management.

Saves the result back to x_diff.

For a no-memory managed version see tanh_pointwise_grad_plain.

fn tanh_pointwise_grad_plain(&self, x: &SharedTensor<F>, x_diff: &mut SharedTensor<F>) -> Result<(), Error>

Computes the gradient of tanh over the input Tensor x without any memory management.

Saves the result back to x_diff.

Attention:
For a correct computation result, you need to manage the memory allocation and synchronization yourself.
For a memory managed version see tanh_pointwise_grad.

Implementors