Trait coaster_nn::Softmax
source · pub trait Softmax<F>: NN<F> {
// Required methods
fn softmax(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>
) -> Result<(), Error>;
fn softmax_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>
) -> Result<(), Error>;
}
Expand description
Provides the functionality for a Backend to support Softmax operations.
Required Methods§
sourcefn softmax(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>
) -> Result<(), Error>
fn softmax( &self, x: &SharedTensor<F>, result: &mut SharedTensor<F> ) -> Result<(), Error>
Computes a [Softmax][softmax] over the input Tensor x
.
[softmax]: https://en.wikipedia.org/wiki/Softmax_function
Saves the result to result
.
sourcefn softmax_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>
) -> Result<(), Error>
fn softmax_grad( &self, x: &SharedTensor<F>, x_diff: &SharedTensor<F>, result_diff: &mut SharedTensor<F> ) -> Result<(), Error>
Computes the gradient of a [Softmax][softmax] over the input Tensor x
.
[softmax]: https://en.wikipedia.org/wiki/Softmax_function
Saves the result to result_diff
.
Object Safety§
This trait is not object safe.