TensorPlay
Reference guides
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.accelerator

TensorPlay can run on CPUs and on accelerators such as GPUs. The tensorplay.accelerator module exposes a small, device-agnostic surface for asking which accelerator is currently active, so code that needs to know where tensors live does not have to special-case each backend.

import tensorplay as tp

dev = tp.accelerator.current_accelerator()
print(dev)                      # e.g. 'cuda:0', or None on a CPU-only machine

Functions

tensorplay.accelerator.current_accelerator

The accelerator device selected at build time, if any.

tensorplay.accelerator.device_count

Number of devices for the current accelerator, or zero without one.

tensorplay.accelerator.is_available

Whether an accelerator was built and at least one device is visible.

tensorplay.accelerator.current_device_index

Index of the currently selected accelerator device.

tensorplay.accelerator.set_device_index

Select the accelerator device by index; negative indices are no-ops.

tensorplay.accelerator.get_device_capability

Capability map for an accelerator device.

tensorplay.accelerator.synchronize

Wait for all work on an accelerator device to complete.

tensorplay.accelerator.Graph

Capture/replay graph on the current accelerator device.

Submodules

tensorplay.accelerator.memory

Device-agnostic memory queries for the current accelerator.

tensorplay.accelerator.random

Device-agnostic random-number helpers for the current accelerator.

tensorplay.accelerator.graphs

Device-agnostic capture/replay graphs for the current accelerator.

Where to go next

  • CUDA semantics — the CUDA backend the accelerator is most often backed by, and its device-management functions.

  • Device concepts — how device objects are spelled and compared.

On this page

Ask DeepWiki