TFDWT: Fast Discrete Wavelet Transform TensorFlow Layers 
Fast $1\text{D}$, $2\text{D}$ and $3\text{D}$ Discrete Wavelet Transform ($\text{DWT}$) and Inverse Discrete Wavelet Transform ($\text{IDWT}$) layers for backpropagation networks.
Available wavelet families ―
Haar (haar)
Daubechies (db)
Symlets (sym)
Coiflets (coif)
Biorthogonal (bior)
Reverse biorthogonal (rbio)
Note ― Shape requirements
- Single‑level: dimensions must be even. For 1D,
Nis even; for 2D and 3D, each side is even and the input is square/cubic respectively. - Multilevel (L levels): each side must be divisible by $2^L$. In practice, pad to the nearest multiple of $2^L$ when needed.
- Our examples and tests center‑pad rather than crop, to preserve data.
Installation guide
The installation of the TFDWT package is recommended inside a virtual environment with tensorflow[and-cuda] installed at first.
Pre-installation checks (Tested in Gentoo and Debian bookworm)
- Create a new virtual enironment with a specific Python version (use the Python version supported by TensorFlow)
conda info --envs
env_name='tf219'
conda create -n $env_name python=3.12 ipykernel
# activate virtual environment
conda activate tf219
- Install TensorFlow using official guide in https://www.tensorflow.org/install/pip
# For GPU users
pip install tensorflow[and-cuda]
# Verify setup
python3 -c "import tensorflow as tf; print(f'{tf.config.list_physical_devices('GPU')}, \nTF version {tf.__version__}')"
Install TFDWT from PyPI (Option $1$)
pip install TFDWT
Install TFDWT from Github (Option $2$)
Download the package
git clone https://github.com/kkt-ee/TFDWT.git
Change directory to the downloaded TFDWT
cd TFDWT
Run the following command to install the TFDWT package
pip install .
Verify installation
Compute $\text{DWT}$ $1\text{D}$ and $\text{IDWT}$ $1\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, length, channels})$
"""Perfect Reconstruction 1D DWT level-1 Filter bank"""
from TFDWT.DWT1DFB import DWT1D, IDWT1D
LH = DWT1D(wave='bior3.1')(x) # Analysis
x_hat = IDWT1D(wave='bior3.1')(LH) # Synthesis
Compute $\text{DWT}$ $2\text{D}$ and $\text{IDWT}$ $2\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, height, width, channels})$
"""Perfect Reconstruction 2D DWT level-1 Filter bank"""
from TFDWT.DWT2DFB import DWT2D, IDWT2D
LLLHHLHH = DWT2D(wave='bior1.3')(x) # Analysis
x_hat = IDWT2D(wave='bior1.3')(LLLHHLHH) # Synthesis
# `wave` can be any supported orthogonal or biorthogonal wavelet
Compute $\text{DWT}$ $3\text{D}$ and $\text{IDWT}$ $3\text{D}$ of batched, multichannel $x$ of shape $(\text{batch, height, width, depth, channels})$
"""Perfect Reconstruction 3D DWT level-1 Filter bank"""
from TFDWT.DWT3DFB import DWT3D, IDWT3D
LLLLLHLHLLHHHLLHLHHHLHHH = DWT3D(wave='bior1.3')(x) # Analysis
x_hat = IDWT3D(wave='bior1.3')(LLLLLHLHLLHHHLLHLHHHLHHH) # Synthesis
# `wave` can be any supported orthogonal or biorthogonal wavelet
NOTE ― Using the above forward and inverse transforms the above $\text{DWT}$ and $\text{IDWT}$ layers can be used to construct multilevel $\text{DWT}$ filter banks and $\text{Wave Packet Transform}$ filter banks.
Multilevel helpers (convenience API)
The package also provides simple helpers for building multilevel pyramids using the single‑level layers internally.
1D
from TFDWT.multilevel.dwt import dwt, idwt
level = 3
subbands = dwt(x, level=level, Ψ='haar') # returns [H1, H2, ..., HL, LL]
x_hat = idwt(subbands, level=level, Ψ='haar')
2D
from TFDWT.multilevel.dwt2 import dwt2, idwt2
level = 3
subbands = dwt2(x, level=level, Ψ='haar') # [H1, H2, ..., HL, LL]
x_hat = idwt2(subbands, level=level, Ψ='haar')
3D
from TFDWT.multilevel.dwt3 import dwt3, idwt3
level = 3
subbands = dwt3(x, level=level, Ψ='haar') # [H1, H2, ..., HL, LL]
x_hat = idwt3(subbands, level=level, Ψ='haar')
Each Hi contains all high‑pass subbands at level i (1 for 1D, 3 for 2D, 7 for 3D), concatenated along the channel axis; the last element is the final low‑pass LL.
Package is tested with dependency versions
Python 3.12.7
TensorFlow 2.15+ (verified on 2.21.0)
Keras 2 and 3
CUDA 12+
Uninstall TFDWT
pip uninstall TFDWT
TFDWT (C) 2026 Kishore Kumar Tarafdar, भारत 🇮🇳
Metadata
Release files for TFDWT 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tfdwt-0.1.2.tar.gz | 58.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tfdwt-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 124.6 kB
Release files / tfdwt-0.1.2.tar.gz
| Download URL | tfdwt-0.1.2.tar.gz |
|---|---|
| Size | 58.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c0a846a6c816b1532e9c8f18b0acafe8bf9d4a55551f3a131a9b5cf9bde4ccb
|
|
BLAKE2b-256 checksum How to use checksums |
c002b2de1b05449fec9decb6b0757af5c11067f25f3f2fca6d708ffc7dc86f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / tfdwt-0.1.2-py3-none-any.whl
| Download URL | tfdwt-0.1.2-py3-none-any.whl |
|---|---|
| Size | 66.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ddc1ac328809b02984ea2f1abdd8a8700ab71de60f5027dee7f00abe07fb656
|
|
BLAKE2b-256 checksum How to use checksums |
400aeaa88e7ddc97b666b969cf48da6b340efc4ae57969fc09baa37f675b31fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|