Trait juice::layers::common::FilterLayer [−][src]
pub trait FilterLayer {
fn calculate_output_shape(&self, input_shape: &[usize]) -> Vec<usize>;
fn num_spatial_dims(&self, input_shape: &[usize]) -> usize;
fn filter_shape(&self) -> &[usize]ⓘ;
fn stride(&self) -> &[usize]ⓘ;
fn padding(&self) -> &[usize]ⓘ;
fn calculate_spatial_output_dims(
input_dims: &[usize],
filter_dims: &[usize],
padding: &[usize],
stride: &[usize]
) -> Vec<usize> { ... }
fn spatial_filter_dims(&self, num_spatial_dims: usize) -> Vec<usize> { ... }
fn stride_dims(&self, num_spatial_dims: usize) -> Vec<usize> { ... }
fn padding_dims(&self, num_spatial_dims: usize) -> Vec<usize> { ... }
}
Expand description
Provides common utilities for Layers that utilize a filter with stride and padding.
This is used by the Convolution and Pooling layers.
Required methods
Calculate output shape based on the shape of filter, padding, stride and input.
Calculates the number of spatial dimensions for the pooling operation.
The filter_shape that will be used by spatial_filter_dims
.
The stride that will be used by stride_dims
.
Provided methods
Computes the shape of the spatial dimensions.
fn spatial_filter_dims(&self, num_spatial_dims: usize) -> Vec<usize>
fn spatial_filter_dims(&self, num_spatial_dims: usize) -> Vec<usize>
Retrievs the spatial dimensions for the filter based on self.filter_shape()
and the number of spatial dimensions.
The spatial dimensions only make up part of the whole filter shape. The other parts are the number of input and output feature maps.
fn stride_dims(&self, num_spatial_dims: usize) -> Vec<usize>
fn stride_dims(&self, num_spatial_dims: usize) -> Vec<usize>
Retrievs the stride for the convolution based on self.stride
and the number of spatial dimensions.
fn padding_dims(&self, num_spatial_dims: usize) -> Vec<usize>
fn padding_dims(&self, num_spatial_dims: usize) -> Vec<usize>
Retrievs the padding for the convolution based on self.padding
and the number of spatial dimensions.