torch.cpu#
Created On: Jul 11, 2023 | Last Updated On: Oct 13, 2025
This package implements abstractions found intorch.cudato facilitate writing device-agnostic code.
current_device | Returns current device for cpu. |
current_stream | Returns the currently selected |
is_available | Returns a bool indicating if CPU is currently available. |
is_initialized | Returns True if the CPU is initialized. |
synchronize | Waits for all kernels in all streams on the CPU device to complete. |
stream | Wrapper around the Context-manager StreamContext that selects a given stream. |
set_device | Sets the current device, in CPU we do nothing. |
device_count | Returns number of CPU devices (not cores). |
StreamContext | Context-manager that selects a given stream. |
Streams and events#
Stream | N.B. |