mod conv;
mod conv_fft;
mod dilation;
mod padding;
pub(crate) use padding::ExplicitPadding;
pub use conv::ConvExt;
pub use conv_fft::{ConvFFTExt, Processor as FftProcessor};
pub use dilation::WithDilation;
#[derive(Debug, Clone, Copy)]
pub enum ConvMode<const N: usize> {
Full,
Same,
Valid,
Custom {
padding: [usize; N],
strides: [usize; N],
},
Explicit {
padding: [[usize; 2]; N],
strides: [usize; N],
},
}
#[derive(Debug, Clone, Copy)]
pub enum PaddingMode<const N: usize, T: num::traits::NumAssign + Copy> {
Zeros,
Const(T),
Reflect,
Replicate,
Circular,
Custom([BorderType<T>; N]),
Explicit([[BorderType<T>; 2]; N]),
}
#[derive(Debug, Clone, Copy)]
pub enum BorderType<T: num::traits::NumAssign + Copy> {
Zeros,
Const(T),
Reflect,
Replicate,
Circular,
}
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error<const N: usize> {
#[error("Data shape shouldn't have ZERO. {0:?}")]
DataShape(ndarray::Dim<[ndarray::Ix; N]>),
#[error("Kernel shape shouldn't have ZERO. {0:?}")]
KernelShape(ndarray::Dim<[ndarray::Ix; N]>),
#[error("ConvMode {0:?} does not match KernelWithDilation Size {1:?}")]
MismatchShape(ConvMode<N>, [ndarray::Ix; N]),
}