summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-torch-complex.spec337
-rw-r--r--sources1
3 files changed, 339 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..6224bee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/torch_complex-0.4.3.tar.gz
diff --git a/python-torch-complex.spec b/python-torch-complex.spec
new file mode 100644
index 0000000..e0b8440
--- /dev/null
+++ b/python-torch-complex.spec
@@ -0,0 +1,337 @@
+%global _empty_manifest_terminate_build 0
+Name: python-torch-complex
+Version: 0.4.3
+Release: 1
+Summary: A fugacious python class for PyTorch-ComplexTensor
+License: Apache Software License
+URL: https://github.com/kamo-naoyuki/torch_complex
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/1d/fe/638980e57d68dd79fa94d7db43598b2c2bceb74a3715774d854476c556d1/torch_complex-0.4.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-numpy
+
+%description
+# pytorch_complex
+
+[![PyPI version](https://badge.fury.io/py/torch-complex.svg)](https://badge.fury.io/py/torch-complex)
+[![Python Versions](https://img.shields.io/pypi/pyversions/torch-complex.svg)](https://pypi.org/project/torch-complex/)
+[![Downloads](https://pepy.tech/badge/torch-complex)](https://pepy.tech/project/torch-complex)
+[![Build Status](https://travis-ci.org/kamo-naoyuki/pytorch_complex.svg?branch=master)](https://travis-ci.org/kamo-naoyuki/pytorch_complex)
+[![codecov](https://codecov.io/gh/kamo-naoyuki/pytorch_complex/branch/master/graph/badge.svg)](https://codecov.io/gh/kamo-naoyuki/pytorch_complex)
+
+A temporal python class for PyTorch-ComplexTensor
+
+
+## What is this?
+A Python class to perform as `ComplexTensor` in PyTorch: Nothing except for the following,
+
+```python
+class ComplexTensor:
+ def __init__(self, ...):
+ self.real = torch.Tensor(...)
+ self.imag = torch.Tensor(...)
+```
+
+### Why?
+PyTorch is great DNN Python library, except that it doesn't support `ComplexTensor` in Python level.
+
+https://github.com/pytorch/pytorch/issues/755
+
+I'm looking forward to the completion, but I need `ComplexTensor` for now.
+ I created this cheap module for the temporal replacement of it. Thus, I'll throw away this project as soon as `ComplexTensor` is completely supported!
+
+## Requirements
+
+```
+Python>=3.6
+PyTorch>=1.0
+```
+
+## Install
+
+```
+pip install torch_complex
+```
+
+## How to use
+
+### Basic mathematical operation
+```python
+import numpy as np
+from torch_complex.tensor import ComplexTensor
+
+real = np.random.randn(3, 10, 10)
+imag = np.random.randn(3, 10, 10)
+
+x = ComplexTensor(real, imag)
+x.numpy()
+
+x + x
+x * x
+x - x
+x / x
+x ** 1.5
+x @ x # Batch-matmul
+x.conj()
+x.inverse() # Batch-inverse
+```
+
+All are implemented with combinations of computation of `RealTensor` in python level, thus the speed is not good enough.
+
+
+### Functional
+
+```python
+import torch_complex.functional as F
+F.cat([x, x])
+F.stack([x, x])
+F.matmul(x, x) # Same as x @ x
+F.einsum('bij,bjk,bkl->bil', [x, x, x])
+```
+
+### For DNN
+Almost all methods that `torch.Tensor` has are implemented.
+
+```python
+x.cuda()
+x.cpu()
+(x + x).sum().backward()
+```
+
+
+
+
+%package -n python3-torch-complex
+Summary: A fugacious python class for PyTorch-ComplexTensor
+Provides: python-torch-complex
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-torch-complex
+# pytorch_complex
+
+[![PyPI version](https://badge.fury.io/py/torch-complex.svg)](https://badge.fury.io/py/torch-complex)
+[![Python Versions](https://img.shields.io/pypi/pyversions/torch-complex.svg)](https://pypi.org/project/torch-complex/)
+[![Downloads](https://pepy.tech/badge/torch-complex)](https://pepy.tech/project/torch-complex)
+[![Build Status](https://travis-ci.org/kamo-naoyuki/pytorch_complex.svg?branch=master)](https://travis-ci.org/kamo-naoyuki/pytorch_complex)
+[![codecov](https://codecov.io/gh/kamo-naoyuki/pytorch_complex/branch/master/graph/badge.svg)](https://codecov.io/gh/kamo-naoyuki/pytorch_complex)
+
+A temporal python class for PyTorch-ComplexTensor
+
+
+## What is this?
+A Python class to perform as `ComplexTensor` in PyTorch: Nothing except for the following,
+
+```python
+class ComplexTensor:
+ def __init__(self, ...):
+ self.real = torch.Tensor(...)
+ self.imag = torch.Tensor(...)
+```
+
+### Why?
+PyTorch is great DNN Python library, except that it doesn't support `ComplexTensor` in Python level.
+
+https://github.com/pytorch/pytorch/issues/755
+
+I'm looking forward to the completion, but I need `ComplexTensor` for now.
+ I created this cheap module for the temporal replacement of it. Thus, I'll throw away this project as soon as `ComplexTensor` is completely supported!
+
+## Requirements
+
+```
+Python>=3.6
+PyTorch>=1.0
+```
+
+## Install
+
+```
+pip install torch_complex
+```
+
+## How to use
+
+### Basic mathematical operation
+```python
+import numpy as np
+from torch_complex.tensor import ComplexTensor
+
+real = np.random.randn(3, 10, 10)
+imag = np.random.randn(3, 10, 10)
+
+x = ComplexTensor(real, imag)
+x.numpy()
+
+x + x
+x * x
+x - x
+x / x
+x ** 1.5
+x @ x # Batch-matmul
+x.conj()
+x.inverse() # Batch-inverse
+```
+
+All are implemented with combinations of computation of `RealTensor` in python level, thus the speed is not good enough.
+
+
+### Functional
+
+```python
+import torch_complex.functional as F
+F.cat([x, x])
+F.stack([x, x])
+F.matmul(x, x) # Same as x @ x
+F.einsum('bij,bjk,bkl->bil', [x, x, x])
+```
+
+### For DNN
+Almost all methods that `torch.Tensor` has are implemented.
+
+```python
+x.cuda()
+x.cpu()
+(x + x).sum().backward()
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for torch-complex
+Provides: python3-torch-complex-doc
+%description help
+# pytorch_complex
+
+[![PyPI version](https://badge.fury.io/py/torch-complex.svg)](https://badge.fury.io/py/torch-complex)
+[![Python Versions](https://img.shields.io/pypi/pyversions/torch-complex.svg)](https://pypi.org/project/torch-complex/)
+[![Downloads](https://pepy.tech/badge/torch-complex)](https://pepy.tech/project/torch-complex)
+[![Build Status](https://travis-ci.org/kamo-naoyuki/pytorch_complex.svg?branch=master)](https://travis-ci.org/kamo-naoyuki/pytorch_complex)
+[![codecov](https://codecov.io/gh/kamo-naoyuki/pytorch_complex/branch/master/graph/badge.svg)](https://codecov.io/gh/kamo-naoyuki/pytorch_complex)
+
+A temporal python class for PyTorch-ComplexTensor
+
+
+## What is this?
+A Python class to perform as `ComplexTensor` in PyTorch: Nothing except for the following,
+
+```python
+class ComplexTensor:
+ def __init__(self, ...):
+ self.real = torch.Tensor(...)
+ self.imag = torch.Tensor(...)
+```
+
+### Why?
+PyTorch is great DNN Python library, except that it doesn't support `ComplexTensor` in Python level.
+
+https://github.com/pytorch/pytorch/issues/755
+
+I'm looking forward to the completion, but I need `ComplexTensor` for now.
+ I created this cheap module for the temporal replacement of it. Thus, I'll throw away this project as soon as `ComplexTensor` is completely supported!
+
+## Requirements
+
+```
+Python>=3.6
+PyTorch>=1.0
+```
+
+## Install
+
+```
+pip install torch_complex
+```
+
+## How to use
+
+### Basic mathematical operation
+```python
+import numpy as np
+from torch_complex.tensor import ComplexTensor
+
+real = np.random.randn(3, 10, 10)
+imag = np.random.randn(3, 10, 10)
+
+x = ComplexTensor(real, imag)
+x.numpy()
+
+x + x
+x * x
+x - x
+x / x
+x ** 1.5
+x @ x # Batch-matmul
+x.conj()
+x.inverse() # Batch-inverse
+```
+
+All are implemented with combinations of computation of `RealTensor` in python level, thus the speed is not good enough.
+
+
+### Functional
+
+```python
+import torch_complex.functional as F
+F.cat([x, x])
+F.stack([x, x])
+F.matmul(x, x) # Same as x @ x
+F.einsum('bij,bjk,bkl->bil', [x, x, x])
+```
+
+### For DNN
+Almost all methods that `torch.Tensor` has are implemented.
+
+```python
+x.cuda()
+x.cpu()
+(x + x).sum().backward()
+```
+
+
+
+
+%prep
+%autosetup -n torch-complex-0.4.3
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-torch-complex -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..5bab7c6
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+24e09f8f0d3e89821f3b25ff0db7e3d0 torch_complex-0.4.3.tar.gz