Trait collenchyma_nn::Softmax [] [src]

pub trait Softmax<F>: NN<F> {
    fn softmax(
        &self,
        x: &mut SharedTensor<F>,
        result: &mut SharedTensor<F>
    ) -> Result<(), Error>; fn softmax_plain(
        &self,
        x: &SharedTensor<F>,
        result: &mut SharedTensor<F>
    ) -> Result<(), Error>; fn softmax_grad(
        &self,
        x: &mut SharedTensor<F>,
        x_diff: &mut SharedTensor<F>,
        result_diff: &mut SharedTensor<F>
    ) -> Result<(), Error>; fn softmax_grad_plain(
        &self,
        x: &SharedTensor<F>,
        x_diff: &SharedTensor<F>,
        result_diff: &mut SharedTensor<F>
    ) -> Result<(), Error>; }

Provides the functionality for a Backend to support Softmax operations.

Required Methods

Computes a Softmax over the input Tensor x with complete memory management.

Saves the result to result.

For a no-memory managed version see softmax_plain.

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

Saves the result to result.

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

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

Saves the result to result_diff.

For a no-memory managed version see softmax_grad_plain.

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

Saves the result to result_diff.

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

Implementors