DCTorch is a Python library providing fast discrete cosine transform (DCT) and inverse discrete cosine transform (IDCT) implementations optimized for PyTorch tensors. It enables efficient frequency domain analysis and manipulation within deep learning models, supporting 2D and 3D transforms. The current version is 0.1.2, and it appears to be actively maintained with recent commits.
pip install dctorchVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to perform 2D Discrete Cosine Transform (DCT) and its inverse (IDCT) on a PyTorch tensor. It includes device selection for GPU acceleration and verifies the reconstruction accuracy.
Verify your PyTorch installation and device setup. Ensure CUDA drivers are up-to-date if using a GPU. Always move tensors to the correct device (e.g., `tensor.to('cuda')`).Convert input tensors to a float type using `.to(torch.float32)` or `.to(torch.float64)` before passing them to `dctorch` functions.
No specific fix, but users should be aware of this behavior and ensure input dimensions are managed appropriately for their use case.