Registry / ai-ml / fft-conv-pytorch

fft-conv-pytorch

JSON →
library1.2.0pypypi✓ verified 91d ago

Implementation of 1D, 2D, and 3D FFT convolutions in PyTorch. Current version 1.2.0, supports padding='same' and half-precision input. Release cadence is irregular; latest updates in 2023.

pip install fft-conv-pytorch
INSTALL
IMPORT
SIG · FFT-CONV-PYTORCH
F
fft-conv-pytorch
ai-mlpythonv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FFTConv1d
✓ from fft_conv_pytorch import FFTConv1d
Correct import path.
FFTConv2d
✓ from fft_conv_pytorch import FFTConv2d
Correct import path.
FFTConv3d
✓ from fft_conv_pytorch import FFTConv3d
Correct import path.

Create a 2D FFT convolutional layer with 'same' padding and run a forward pass.

import torch from fft_conv_pytorch import FFTConv2d conv = FFTConv2d(in_channels=3, out_channels=16, kernel_size=3, padding='same') x = torch.randn(1, 3, 32, 32) y = conv(x) print(y.shape) # torch.Size([1, 16, 32, 32])
Debug
Known issues
breakingRequires PyTorch >= 1.8 for gradient support on dilated convolutions; earlier versions may break gradient computation.
fix
Upgrade PyTorch to >= 1.8.
affects: 1.1.2+
breakingIn version 1.0.1, einsum usage was removed for efficiency; custom gradients from previous versions may not work.
fix
Ensure your code does not rely on gradient computation via einsum; re-implement custom operations if needed.
affects: >=1.0.1
breakingPadding='same' and half-precision support added in 1.2.0; using these with older versions will raise an error.
fix
Upgrade to 1.2.0 or use padding='valid' and full-precision tensors.
affects: <1.2.0
Errors
Common errors & fixes
ImportError: cannot import name 'FFTConv2d' from 'fft_conv_pytorch'
Incorrect import path or library not installed.
fix
Ensure you have installed fft-conv-pytorch and use: from fft_conv_pytorch import FFTConv2d
RuntimeError: Expected all tensors to be on the same device, but found at least two devices
Input tensor and kernel not on the same device (CPU/GPU).
fix
Move both input and model to the same device, e.g., conv.to(device) and x = x.to(device).
ValueError: padding must be 'valid' or 'same'
Padding argument is not one of the allowed values.
fix
Set padding='valid' or padding='same' (supported from v1.2.0+).
Upgrade
Version history
1.2.0latest on PyPI · released Sep 28, 2023
Audit
Dependencies
torchrequiredCore dependency; the library uses PyTorch tensors and FFT operations.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
fft-conv-pytorch — pip install fft-conv-pytorch · libregistry