Skip to main content

Torch support of potc.

Project description

potc-torch

PyPI PyPI - Python Version Loc Comments

Code Test Badge Creation Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

potc-torch-0.0.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

potc_torch-0.0.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file potc-torch-0.0.1.tar.gz.

File metadata

  • Download URL: potc-torch-0.0.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for potc-torch-0.0.1.tar.gz
Algorithm Hash digest
SHA256 45dab139afe8f5ff2ceff243dc5d015830946f6609f382d27689b5039f1fd4b0
MD5 637bf3ce9c35f67961258f4ad6cca6f6
BLAKE2b-256 5abd4eb8dec439a9550073a24d8de59924b4e30e6d112a8215e460ef43b87a32

See more details on using hashes here.

File details

Details for the file potc_torch-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: potc_torch-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for potc_torch-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c382e654ee659ed9176b47095decd6d012b023732c7f8a6af1513acea31bb8fa
MD5 52cfcce09fc055f9e9cf683d9fad42bf
BLAKE2b-256 c60700caacde95a87e92d878c9641629672a48eee94f59b04f1b6ec5aa7eba84

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page