--- id: torch-complex version: "0.4.4" license: unclear license_treatment: permissive maintenance: dormant --- # torch-complex — A fugacious python class for PyTorch-ComplexTensor License: permissive · Maintenance: dormant · Downloads: 413.7K/mo ## What it is and what it does torch_complex is a thin wrapper that simulates PyTorch's missing ComplexTensor type by pairing real and imaginary torch.Tensor objects. It implements basic arithmetic (addition, multiplication, division, exponentiation), matrix operations (batch matmul, batch inverse, conjugate), and functional operations (cat, stack, einsum) on complex values. The package also supports GPU operations (cuda/cpu) and autograd backpropagation. The author explicitly describes this as a temporary workaround for PyTorch's lack of native complex tensor support at the Python level, intending to deprecate it once PyTorch adds the feature. All operations are implemented by composing real-valued PyTorch operations at the Python level, so performance is not optimized. It requires Python 3.6+ and PyTorch 1.0+. Use it for: - Prototyping signal processing or Fourier-domain neural networks when native PyTorch complex support is unavailable. - Implementing complex-valued layers in deep learning models that require complex arithmetic. - Performing batch matrix operations on complex-valued data (matmul, inverse, einsum). - Training models with complex-valued activations or loss functions using autograd. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python class wrapping real and imaginary PyTorch tensors to simulate complex tensor operations until native PyTorch support arrives. No. The package is dormant and explicitly positioned as a temporary workaround. PyTorch has since added native ComplexTensor support, making this wrapper unnecessary for modern projects. Install only if you are locked into an old PyTorch version that lacks complex tensor support and cannot upgrade. ## Install pip install torch-complex uv add torch-complex poetry add torch-complex ## Installing torch-complex Before you install: Low install friction with only packaging and numpy as runtime dependencies. Package is dormant (777 days since last release) but marked Production/Stable; use only if you accept no active maintenance. License in practice: Licensed under Apache Software License (permissive), imposing no significant restrictions on use or modification. Quickstart: pip install torch_complex from torch_complex.tensor import ComplexTensor import numpy as np real = np.random.randn(3, 10, 10) imag = np.random.randn(3, 10, 10) x = ComplexTensor(real, imag) result = x + x Requires PyTorch 1.0+ and Python 3.6+; performance is poor because all operations are implemented in Python rather than at the C++ level. Verify before relying: - Whether PyTorch has since added native ComplexTensor support that would make this package obsolete. - Performance characteristics compared to native PyTorch operations or alternative complex tensor libraries. - Compatibility with recent PyTorch versions beyond those listed in classifiers. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 413.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags complex tensor pytorch, complex number deep learning, pytorch complex arithmetic, complex tensor operations, complex matrix operations pytorch, complex valued neural networks, complex-numbers, deprecated-workaround [View on SkillFed](https://skillfed.io/packages/torch-complex) · [View on PyPI](https://pypi.org/project/torch-complex/)