ndarray-conv
ndarray-conv is a crate that provides a N-Dimension convolutions (with FFT acceleration) library in pure Rust.
Inspired by
ndarray-vision (https://github.com/rust-cv/ndarray-vision)
convolutions-rs (https://github.com/Conzel/convolutions-rs#readme)
pocketfft (https://github.com/mreineck/pocketfft)
Roadmap
- basic conv for N dimension
Array
/ArrayView
- conv with FFT acceleration for N dimension
Array
/ArrayView
- impl
ConvMode
andPaddingMode
-
ConvMode
: Full Same Valid Custom Explicit -
PaddingMode
: Zeros Const Reflect Replicate Circular Custom Explicit
-
- conv with strides
- kernel with dilation
- handle input size error
- explict error type
- bench with similar libs
Examples
use *;
x_nd.conv;
x_1d.view.conv_fft;
x_2d.conv_fft;
// avoid loss of accuracy for fft ver
// convert Integer to Float before caculate.
x_3d.map
.conv_fft
.unwrap
.map;
Benchmark
let x = random;
let k = random;
fft_1d time:
fft_with_processor_1d time:
torch_1d time:
fftconvolve_1d time:
---------------------------------------------------------------
let x = random;
let k = random;
fft_2d time:
fft_with_processor_2d time:
torch_2d time:
ndarray_vision_2d time:
fftconvolve_2d time:
---------------------------------------------------------------
let x = random;
let k = random;
fft_3d time:
fft_with_processor_3d time:
torch_3d time:
fftconvolve_3d time:
Versions
- 0.3.4 - Bug fix: fix unsafe type cast in circular padding.
- 0.3.3 - Bug fix: correct conv_fft's output shape.
- 0.3.2 - Improve performance, by modifying
good_fft_size
andtranspose
. - 0.3.1 - Impl basic error type. Fix some bugs.
- 0.3.0 - update to N-Dimension convolution.
- 0.2.0 - finished
conv_2d
&conv_2d_fft
.