Trait coaster_nn::Pooling
source · pub trait Pooling<F>: NN<F> {
// Required methods
fn new_pooling_config(
&self,
window: &[i32],
stride: &[i32],
padding: &[i32]
) -> Result<Self::CPOOL, Error>;
fn pooling_max(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>;
fn pooling_max_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>;
fn pooling_avg(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>;
fn pooling_avg_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>;
}
Expand description
Provides the functionality for a Backend to support Pooling operations.
Required Methods§
sourcefn new_pooling_config(
&self,
window: &[i32],
stride: &[i32],
padding: &[i32]
) -> Result<Self::CPOOL, Error>
fn new_pooling_config( &self, window: &[i32], stride: &[i32], padding: &[i32] ) -> Result<Self::CPOOL, Error>
Creates a new PoolingConfig, which needs to be passed to further pooling Operations.
sourcefn pooling_max(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>
fn pooling_max( &self, x: &SharedTensor<F>, result: &mut SharedTensor<F>, config: &Self::CPOOL ) -> Result<(), Error>
Computes non-linear down-sampling ([max Pooling][pooling]) over the input Tensor x
.
[pooling]: https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer
Saves the result to result
.
sourcefn pooling_max_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>
fn pooling_max_grad( &self, x: &SharedTensor<F>, x_diff: &SharedTensor<F>, result: &SharedTensor<F>, result_diff: &mut SharedTensor<F>, config: &Self::CPOOL ) -> Result<(), Error>
Computes the gradient of [max Pooling][pooling] over the input Tensor x
.
[pooling]: https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer
Saves the result to result_diff
.
sourcefn pooling_avg(
&self,
x: &SharedTensor<F>,
result: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>
fn pooling_avg( &self, x: &SharedTensor<F>, result: &mut SharedTensor<F>, config: &Self::CPOOL ) -> Result<(), Error>
Computes non-linear down-sampling ([average Pooling][pooling]) over the input Tensor x
.
[pooling]: https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer
Saves the result to result
.
sourcefn pooling_avg_grad(
&self,
x: &SharedTensor<F>,
x_diff: &SharedTensor<F>,
result: &SharedTensor<F>,
result_diff: &mut SharedTensor<F>,
config: &Self::CPOOL
) -> Result<(), Error>
fn pooling_avg_grad( &self, x: &SharedTensor<F>, x_diff: &SharedTensor<F>, result: &SharedTensor<F>, result_diff: &mut SharedTensor<F>, config: &Self::CPOOL ) -> Result<(), Error>
Computes the gradient of [average Pooling][pooling] over the input Tensor x
.
[pooling]: https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer
Saves the result to result_diff
.