Readonly
idDevice identifiers
Readonly
typeDevice type identifier (e.g., 'cpu', 'webgpu', 'cuda')
Free CPU memory
For CPU backend, this is mostly a no-op as JavaScript handles GC, but we can clear the buffer reference to help GC.
Execute a tensor operation
Dispatches to specific operation implementations based on the operation type.
Optional
output: DeviceDataRead data from CPU memory
For CPU backend, this returns the buffer directly.
Check if CPU backend supports non-contiguous tensors for a specific operation
For the CPU demo backend, we don't support non-contiguous tensors for any operations to keep the implementation simple. All operations expect contiguous data.
CPU computation device
Implements tensor operations on the CPU using TypedArrays for efficient numerical computation in JavaScript/TypeScript.