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
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
example here
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchcompat-1.1.4.tar.gz
(5.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchcompat-1.1.4.tar.gz.
File metadata
- Download URL: torchcompat-1.1.4.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fabd54bea79624f2e7058842f38536b3d80b2a586c1ac88303d42b8e06ae8c84
|
|
| MD5 |
2a0b3cb74f9a4f4a8de7d29797755a1c
|
|
| BLAKE2b-256 |
2cdeac95694f30034e716e83427a1e9e84ea368735b566300f696178e9e910be
|
File details
Details for the file torchcompat-1.1.4-py3-none-any.whl.
File metadata
- Download URL: torchcompat-1.1.4-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3b3c56717590450588a4d431be387355d16864fdd74edb22fb189b9feca47b
|
|
| MD5 |
9ce230c5d8993854bc52f95edc03fd3a
|
|
| BLAKE2b-256 |
94b29b5d6f9aa9ffc7d35a42ff8a0e2fcf2e9458be5f0bb6077ad98925f8c043
|