pub struct ConvolutionConfig {
pub conv_type: ConvolutionType,
pub input_dims: Vec<usize>,
pub output_dims: Vec<usize>,
pub kernel_dims: Vec<usize>,
pub strides: Vec<usize>,
pub padding: Vec<usize>,
pub dilation: Vec<usize>,
pub groups: usize,
pub padding_mode: PaddingMode,
pub dtype: DType,
pub algorithm: ConvolutionAlgorithm,
}Expand description
Convolution configuration
Fields§
§conv_type: ConvolutionTypeConvolution type
input_dims: Vec<usize>Input dimensions [batch, channels, height, width] for 2D
output_dims: Vec<usize>Output dimensions [batch, channels, height, width] for 2D
kernel_dims: Vec<usize>Kernel dimensions [out_channels, in_channels, height, width] for 2D
strides: Vec<usize>Stride in each dimension
padding: Vec<usize>Padding in each dimension
dilation: Vec<usize>Dilation in each dimension
groups: usizeNumber of groups for grouped convolution
padding_mode: PaddingModePadding mode
dtype: DTypeData type
algorithm: ConvolutionAlgorithmPreferred algorithm
Implementations§
Source§impl ConvolutionConfig
impl ConvolutionConfig
Sourcepub fn conv2d(
batch_size: usize,
in_channels: usize,
out_channels: usize,
input_size: (usize, usize),
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
) -> Self
pub fn conv2d( batch_size: usize, in_channels: usize, out_channels: usize, input_size: (usize, usize), kernel_size: (usize, usize), stride: (usize, usize), padding: (usize, usize), ) -> Self
Create a new 2D convolution configuration
Sourcepub fn depthwise_conv2d(
batch_size: usize,
channels: usize,
input_size: (usize, usize),
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
) -> Self
pub fn depthwise_conv2d( batch_size: usize, channels: usize, input_size: (usize, usize), kernel_size: (usize, usize), stride: (usize, usize), padding: (usize, usize), ) -> Self
Create a depthwise convolution configuration
Sourcepub fn with_algorithm(self, algorithm: ConvolutionAlgorithm) -> Self
pub fn with_algorithm(self, algorithm: ConvolutionAlgorithm) -> Self
Set the algorithm preference
Sourcepub fn with_dtype(self, dtype: DType) -> Self
pub fn with_dtype(self, dtype: DType) -> Self
Set the data type
Sourcepub fn with_dilation(self, dilation: Vec<usize>) -> Self
pub fn with_dilation(self, dilation: Vec<usize>) -> Self
Set dilation
Sourcepub fn input_elements(&self) -> usize
pub fn input_elements(&self) -> usize
Calculate total input elements
Sourcepub fn output_elements(&self) -> usize
pub fn output_elements(&self) -> usize
Calculate total output elements
Sourcepub fn kernel_elements(&self) -> usize
pub fn kernel_elements(&self) -> usize
Calculate total kernel elements
Sourcepub fn input_buffer_size(&self) -> usize
pub fn input_buffer_size(&self) -> usize
Get input buffer size in bytes
Sourcepub fn output_buffer_size(&self) -> usize
pub fn output_buffer_size(&self) -> usize
Get output buffer size in bytes
Sourcepub fn kernel_buffer_size(&self) -> usize
pub fn kernel_buffer_size(&self) -> usize
Get kernel buffer size in bytes
Trait Implementations§
Source§impl Clone for ConvolutionConfig
impl Clone for ConvolutionConfig
Source§fn clone(&self) -> ConvolutionConfig
fn clone(&self) -> ConvolutionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConvolutionConfig
impl RefUnwindSafe for ConvolutionConfig
impl Send for ConvolutionConfig
impl Sync for ConvolutionConfig
impl Unpin for ConvolutionConfig
impl UnsafeUnpin for ConvolutionConfig
impl UnwindSafe for ConvolutionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more