pub struct ConvConfig {
pub kernel_size: Vec<usize>,
pub stride: Vec<usize>,
pub padding: Vec<usize>,
pub dilation: Vec<usize>,
pub groups: usize,
}Expand description
Convolution configuration specifying kernel size, stride, padding, dilation, and groups.
Fields§
§kernel_size: Vec<usize>Kernel size for each spatial dimension (e.g. [3, 3]).
stride: Vec<usize>Stride for each spatial dimension (e.g. [1, 1]).
padding: Vec<usize>Zero-padding on each side for each spatial dimension (e.g. [1, 1]).
dilation: Vec<usize>Dilation factor for each spatial dimension (e.g. [1, 1]).
groups: usizeNumber of groups for grouped convolution (1 = standard convolution).
Implementations§
Source§impl ConvConfig
impl ConvConfig
Sourcepub fn new(kernel_size: Vec<usize>) -> Self
pub fn new(kernel_size: Vec<usize>) -> Self
Create a new convolution config with the given kernel size. Defaults: stride=1, padding=0, dilation=1, groups=1.
Sourcepub fn with_stride(self, stride: Vec<usize>) -> Self
pub fn with_stride(self, stride: Vec<usize>) -> Self
Set the stride (builder pattern).
Sourcepub fn with_padding(self, padding: Vec<usize>) -> Self
pub fn with_padding(self, padding: Vec<usize>) -> Self
Set the padding (builder pattern).
Sourcepub fn with_dilation(self, dilation: Vec<usize>) -> Self
pub fn with_dilation(self, dilation: Vec<usize>) -> Self
Set the dilation (builder pattern).
Sourcepub fn with_groups(self, groups: usize) -> Self
pub fn with_groups(self, groups: usize) -> Self
Set the number of groups (builder pattern).
Sourcepub fn output_size(&self, input_size: usize, dim: usize) -> usize
pub fn output_size(&self, input_size: usize, dim: usize) -> usize
Compute the output size for one spatial dimension.
Formula: (input_size + 2*padding - dilation*(kernel-1) - 1) / stride + 1
Sourcepub fn validate(&self) -> Result<(), ConvError>
pub fn validate(&self) -> Result<(), ConvError>
Validate the configuration, returning an error if any parameter is invalid.
Sourcepub fn num_spatial_dims(&self) -> usize
pub fn num_spatial_dims(&self) -> usize
Number of spatial dimensions (length of kernel_size).
Trait Implementations§
Source§impl Clone for ConvConfig
impl Clone for ConvConfig
Source§fn clone(&self) -> ConvConfig
fn clone(&self) -> ConvConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConvConfig
impl RefUnwindSafe for ConvConfig
impl Send for ConvConfig
impl Sync for ConvConfig
impl Unpin for ConvConfig
impl UnsafeUnpin for ConvConfig
impl UnwindSafe for ConvConfig
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
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>
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>
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