potc-torch
Potc support for torch module.
Installation
You can simply install it with pip command line from the official PyPI site.
pip install potc-torch
Quick Start
After potc-torch is installed, you can convert the torch objects into executable source code without any additional operations.
We can create a python script which is named test_simple.py
import torch
from potc import transvars
a = torch.randn(2, 3)
b = torch.randint(-5, 10, (3, 4))
bs = b.size()
bd = b.device
if __name__ == '__main__':
_code = transvars(
{'a': a, 'b': b, 'bs': bs, 'bd': bd},
reformat='pep8',
)
print(_code)
The output result should be like this (may be slightly different because of the usage of torch.randn and torch.randint)
import torch
__all__ = ['a', 'b', 'bd', 'bs']
a = torch.as_tensor(
[[0.6224261522293091, 0.4725508689880371, 0.45328783988952637],
[-0.5855962634086609, 0.4898407459259033, 0.4769541621208191]],
dtype=torch.float32)
b = torch.as_tensor([[2, 7, 4, -3], [-2, 4, 8, 1], [7, -5, 3, 6]],
dtype=torch.long)
bd = torch.device('cpu')
bs = torch.Size([3, 4])
And, you can use the following CLI command to get the same output results as above.
potc export -v 'test_simple.a' -v 'test_simple.b*'
Contributing
We appreciate all contributions to improve potc and potc-torch, both logic and system designs. Please refer to CONTRIBUTING.md for more guides.
License
potc-torch released under the Apache 2.0 license.
Metadata
Release files for potc-torch 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| potc-torch-0.0.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| potc_torch-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / potc-torch-0.0.1.tar.gz
| Download URL | potc-torch-0.0.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45dab139afe8f5ff2ceff243dc5d015830946f6609f382d27689b5039f1fd4b0
|
|
BLAKE2b-256 checksum How to use checksums |
5abd4eb8dec439a9550073a24d8de59924b4e30e6d112a8215e460ef43b87a32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / potc_torch-0.0.1-py3-none-any.whl
| Download URL | potc_torch-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c382e654ee659ed9176b47095decd6d012b023732c7f8a6af1513acea31bb8fa
|
|
BLAKE2b-256 checksum How to use checksums |
c60700caacde95a87e92d878c9641629672a48eee94f59b04f1b6ec5aa7eba84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|