TorchMorph: CUDA-accelerated Morphological Transforms
Summary
TorchMorph is a CUDA-accelerated PyTorch extension that provides GPU-optimized morphological and distance transform operators, achieving significant speed-ups over CPU implementations like SciPy with a compatible API.
View Cached Full Text
Cached at: 08/26/26, 03:14 AM
Paper page - TorchMorph: CUDA-accelerated Morphological Transforms
Source: https://huggingface.co/papers/2608.24738
Abstract
TorchMorph is a PyTorch extension providing GPU-accelerated morphological and distance-transform operators across up to eight dimensions with a SciPy-compatible API.
Morphological transformsare long-standing tools for shape and mask processing, but the de facto reference implementation in the Python ecosystem, i.e. scipy.ndimage, is CPU-only, single-array, and therefore unusable inside a GPU training loop without an expensive device-to-host round trip. GPU vision libraries built on PyTorch cover a narrow subset of these operators, typically restricted to two spatial dimensions and flat structuring elements. We presentTorchMorph, a lightweight PyTorch extension that closes this gap.TorchMorphexposes 22 public operators coveringbinary morphology,greyscale morphology, exact and approximatedistance transforms, andentropy-regularised optimal transport, all implemented as fusedCUDA kernelsthat operate directly on (B, C, Spatial...) CUDA tensors with up to eight spatial dimensions. The API deliberately mirrors scipy.ndimage argument-for-argument, including border modes, structuring-element origins and pre-allocated outputs, so that existing pipelines port with a change of import. We describe the layered architecture and the kernel designs behind each operator family. Against single-threaded CPU references, batched execution reaches up to 1.1e3 times the throughput of scipy.ndimage ongreyscale morphologyand up to 350x on exact Euclideandistance transforms, while theSinkhorn solverruns up to 42x faster than POT. Binary and chamfer operators reproduce their SciPy counterparts exactly, and every float-valued operator agrees with the CPU reference to within 1.8e-6 absolute error.TorchMorphis released under the MIT licence at https://intcomp.github.io/tm.
View arXiv pageView PDFProject pageGitHubAdd to collection
Get this paper in your agent:
hf papers read 2608\.24738
Don’t have the latest CLI?curl \-LsSf https://hf\.co/cli/install\.sh \| bash
Models citing this paper0
No model linking this paper
Cite arxiv.org/abs/2608.24738 in a model README.md to link it from this page.
Datasets citing this paper0
No dataset linking this paper
Cite arxiv.org/abs/2608.24738 in a dataset README.md to link it from this page.
Spaces citing this paper0
No Space linking this paper
Cite arxiv.org/abs/2608.24738 in a Space README.md to link it from this page.
Collections including this paper0
No Collection including this paper
Add this paper to acollectionto link it from this page.
Similar Articles
TorchKM: A GPU-Oriented Library for Kernel Learning and Model Selection
TorchKM is an open-source GPU-accelerated library for kernel machines (SVMs, kernel logistic regression, etc.) with a scikit-learn-style API. It accelerates training and model selection by reusing matrix operations, offering substantial speedups over standard baselines.
TorchCodec 0.14: HDR Video Decoding for CPU and CUDA, and Fast Wav Decoder
TorchCodec 0.14 adds HDR video decoding for CPU and CUDA, along with a fast WAV decoder, enabling efficient conversion of video and audio data into PyTorch tensors for ML workflows.
TorchNeuron: running HF models on AWS Trainium is easier than ever
TorchNeuron 作为 PyTorch 的原生 Trainium 后端发布公测,Hugging Face 的 Transformers、Diffusers 等库可直接将其作为普通设备使用,显著提升了模型支持率并取代 Optimum Neuron 的复杂封装。
TAGTorch: A PyTorch Library for Geometry, Topology, and Symmetry-Aware Machine Learning
TAGTorch is an open-source PyTorch library that unifies tools for topology, algebra, and geometry-aware machine learning, covering preprocessing, architectures, training techniques, and model analysis.
@FeitengLi: Open-source Flash-SoftDTW provides an ultra-fast, low-memory soft-DTW operator for PyTorch training. It can be used to compute alignment losses for sequences of different lengths, train TTS models, and more. Substantially optimized: compared with a row-by-row sequential CUDA baseline, the forward pass is up to 365× faster, for…
The open-source Flash-SoftDTW project has released an ultra-fast, low-memory soft-DTW operator supporting PyTorch training, delivering up to 365× faster forward passes and up to 98× faster forward-plus-backward passes compared with a row-by-row sequential CUDA baseline. It can be used for alignment losses between sequences of unequal lengths and for training TTS models.