pub trait WithDilation<S: RawData, const N: usize> {
// Required method
fn with_dilation(
&self,
dilation: impl IntoDilation<N>,
) -> KernelWithDilation<'_, S, N>;
}
Expand description
Trait for adding dilation information to a kernel.
Dilation is a parameter that controls the spacing between kernel elements during convolution. A dilation of 1 means no spacing (standard convolution), while larger values insert gaps between kernel elements.
§Example
use ndarray::array;
use ndarray_conv::{WithDilation, ConvExt, ConvMode, PaddingMode};
let input = array![1, 2, 3, 4, 5];
let kernel = array![1, 1, 1];
// Standard convolution (dilation = 1)
let result1 = input.conv(&kernel, ConvMode::Same, PaddingMode::Zeros).unwrap();
// Dilated convolution (dilation = 2)
let result2 = input.conv(kernel.with_dilation(2), ConvMode::Same, PaddingMode::Zeros).unwrap();
Required Methods§
Sourcefn with_dilation(
&self,
dilation: impl IntoDilation<N>,
) -> KernelWithDilation<'_, S, N>
fn with_dilation( &self, dilation: impl IntoDilation<N>, ) -> KernelWithDilation<'_, S, N>
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.