torchcompat


Nametorchcompat JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://torchcompat.readthedocs.io
Summarytorch compatibility layer
upload_time2024-06-26 06:40:30
maintainerNone
docs_urlNone
authorAnonymous
requires_pythonNone
licenseBSD 3-Clause License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            torchcompat
=============================

|pypi| |py_versions| |codecov| |docs| |tests| |style|

.. |pypi| image:: https://img.shields.io/pypi/v/torchcompat.svg
    :target: https://pypi.python.org/pypi/torchcompat
    :alt: Current PyPi Version

.. |py_versions| image:: https://img.shields.io/pypi/pyversions/torchcompat.svg
    :target: https://pypi.python.org/pypi/torchcompat
    :alt: Supported Python Versions

.. |codecov| image:: https://codecov.io/gh/Delaunay/torchcompat/branch/master/graph/badge.svg?token=40Cr8V87HI
   :target: https://codecov.io/gh/Delaunay/torchcompat

.. |docs| image:: https://readthedocs.org/projects/torchcompat/badge/?version=latest
   :target:  https://torchcompat.readthedocs.io/en/latest/?badge=latest

.. |tests| image:: https://github.com/Delaunay/torchcompat/actions/workflows/test.yml/badge.svg?branch=master
   :target: https://github.com/Delaunay/torchcompat/actions/workflows/test.yml

.. |style| image:: https://github.com/Delaunay/torchcompat/actions/workflows/style.yml/badge.svg?branch=master
   :target: https://github.com/Delaunay/torchcompat/actions/workflows/style.yml


.. code-block:: text

   pip install torchcompat


Features
--------

* Provide a super set implementation of pytorch device interface
  to enable code to run seamlessly between different accelerators.
* Identify uniquely devices


.. code-block:: python

   import torchcompat.core as accelerator

   # on  cuda accelerator == torch.cuda
   # on  rocm accelerator == torch.cuda
   # on   xpu accelerator == torch.xpu
   # on gaudi accelerator == ...

   assert accelerator.is_available() == true
   assert accelerator.device_name in ('xpu', 'cuda', "hpu")           # rocm is seen as cuda by pytorch
   assert accelerator.device_string(0) == "cuda:0" or "xpu:0" or "hpu:0"
   assert accelerator.fetch_device(0) == torch.device("cuda:0")


   accelerator.set_enable_tf32(true) # toggle the right flags for each backend


Example
-------

.. code-block:: python

   example here

            

Raw data

            {
    "_id": null,
    "home_page": "https://torchcompat.readthedocs.io",
    "name": "torchcompat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Anonymous",
    "author_email": "anony@mous.com",
    "download_url": "https://files.pythonhosted.org/packages/7d/c9/ad41e9757f19b50b3769fbda8792d67505c89a75f9ff415c8b210db7214b/torchcompat-1.1.1.tar.gz",
    "platform": null,
    "description": "torchcompat\n=============================\n\n|pypi| |py_versions| |codecov| |docs| |tests| |style|\n\n.. |pypi| image:: https://img.shields.io/pypi/v/torchcompat.svg\n    :target: https://pypi.python.org/pypi/torchcompat\n    :alt: Current PyPi Version\n\n.. |py_versions| image:: https://img.shields.io/pypi/pyversions/torchcompat.svg\n    :target: https://pypi.python.org/pypi/torchcompat\n    :alt: Supported Python Versions\n\n.. |codecov| image:: https://codecov.io/gh/Delaunay/torchcompat/branch/master/graph/badge.svg?token=40Cr8V87HI\n   :target: https://codecov.io/gh/Delaunay/torchcompat\n\n.. |docs| image:: https://readthedocs.org/projects/torchcompat/badge/?version=latest\n   :target:  https://torchcompat.readthedocs.io/en/latest/?badge=latest\n\n.. |tests| image:: https://github.com/Delaunay/torchcompat/actions/workflows/test.yml/badge.svg?branch=master\n   :target: https://github.com/Delaunay/torchcompat/actions/workflows/test.yml\n\n.. |style| image:: https://github.com/Delaunay/torchcompat/actions/workflows/style.yml/badge.svg?branch=master\n   :target: https://github.com/Delaunay/torchcompat/actions/workflows/style.yml\n\n\n.. code-block:: text\n\n   pip install torchcompat\n\n\nFeatures\n--------\n\n* Provide a super set implementation of pytorch device interface\n  to enable code to run seamlessly between different accelerators.\n* Identify uniquely devices\n\n\n.. code-block:: python\n\n   import torchcompat.core as accelerator\n\n   # on  cuda accelerator == torch.cuda\n   # on  rocm accelerator == torch.cuda\n   # on   xpu accelerator == torch.xpu\n   # on gaudi accelerator == ...\n\n   assert accelerator.is_available() == true\n   assert accelerator.device_name in ('xpu', 'cuda', \"hpu\")           # rocm is seen as cuda by pytorch\n   assert accelerator.device_string(0) == \"cuda:0\" or \"xpu:0\" or \"hpu:0\"\n   assert accelerator.fetch_device(0) == torch.device(\"cuda:0\")\n\n\n   accelerator.set_enable_tf32(true) # toggle the right flags for each backend\n\n\nExample\n-------\n\n.. code-block:: python\n\n   example here\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "torch compatibility layer",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://torchcompat.readthedocs.io"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dda015d08f206de34611e6aba204f3db487e19bd81b6ebe38b099cf025c86cf8",
                "md5": "628875cff8d11ed3b0694c08e0f4954e",
                "sha256": "627702ab251d12a93545950e1026efb18bbe1ca73268b98791799bf9addd9867"
            },
            "downloads": -1,
            "filename": "torchcompat-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "628875cff8d11ed3b0694c08e0f4954e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8864,
            "upload_time": "2024-06-26T06:40:23",
            "upload_time_iso_8601": "2024-06-26T06:40:23.870833Z",
            "url": "https://files.pythonhosted.org/packages/dd/a0/15d08f206de34611e6aba204f3db487e19bd81b6ebe38b099cf025c86cf8/torchcompat-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7dc9ad41e9757f19b50b3769fbda8792d67505c89a75f9ff415c8b210db7214b",
                "md5": "95f914b7cf521da838e2de06a842954c",
                "sha256": "aebf180cce7a25551c71e0052ae88ffa37b225924e939015adec0e720c9d5154"
            },
            "downloads": -1,
            "filename": "torchcompat-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "95f914b7cf521da838e2de06a842954c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5901,
            "upload_time": "2024-06-26T06:40:30",
            "upload_time_iso_8601": "2024-06-26T06:40:30.132767Z",
            "url": "https://files.pythonhosted.org/packages/7d/c9/ad41e9757f19b50b3769fbda8792d67505c89a75f9ff415c8b210db7214b/torchcompat-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-26 06:40:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "torchcompat"
}
        
Elapsed time: 0.29884s