Expand description
Device handling for Python bindings
This module provides PyO3 bindings for ToRSh device types, allowing Python code to specify and manage computational devices (CPU, CUDA, Metal, etc.).
§Examples
import torsh
# Create devices
cpu = torsh.PyDevice("cpu")
cuda = torsh.PyDevice("cuda:0")
metal = torsh.PyDevice("metal:0")
# Check device properties
print(cpu.type) # "cpu"
print(cuda.index) # 0Structs§
- PyDevice
- Python wrapper for ToRSh devices
Functions§
- parse_
device - Helper function to parse device from Python arguments
- register_
device_ constants - Register device constants and utility functions with the Python module.