Pooling

Trait 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§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

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.

Implementations on Foreign Types§

Source§

impl<T> Pooling<T> for Backend<Cuda>
where T: Float + Default + DataTypeInfo,

Source§

fn new_pooling_config( &self, window: &[i32], stride: &[i32], padding: &[i32], ) -> Result<Self::CPOOL, Error>

Source§

fn pooling_max( &self, x: &SharedTensor<T>, result: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_max_grad( &self, x: &SharedTensor<T>, x_diff: &SharedTensor<T>, result: &SharedTensor<T>, result_diff: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_avg( &self, x: &SharedTensor<T>, result: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_avg_grad( &self, x: &SharedTensor<T>, x_diff: &SharedTensor<T>, result: &SharedTensor<T>, result_diff: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

impl<T> Pooling<T> for Backend<Native>
where T: Add<T, Output = T> + Mul<T, Output = T> + Default + Copy + PartialOrd + Bounded,

Source§

fn new_pooling_config( &self, window: &[i32], stride: &[i32], padding: &[i32], ) -> Result<Self::CPOOL, Error>

Source§

fn pooling_max( &self, x: &SharedTensor<T>, result: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_max_grad( &self, x: &SharedTensor<T>, x_diff: &SharedTensor<T>, result: &SharedTensor<T>, result_diff: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_avg( &self, x: &SharedTensor<T>, result: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Source§

fn pooling_avg_grad( &self, x: &SharedTensor<T>, x_diff: &SharedTensor<T>, result: &SharedTensor<T>, result_diff: &mut SharedTensor<T>, config: &Self::CPOOL, ) -> Result<(), Error>

Implementors§