spdl.io.transfer_tensor¶
- transfer_tensor(batch: T, /, *, num_caches: int = 4) T[source]¶
Transfer PyTorch tensors from CPU to CUDA in a dedicated stream.
Deprecated since version 0.8.0: Use
spdl.io.transfer_tensor_h2d()instead.- Parameters:
batch – A
torch.Tensoror a composition of tensors with container types such aslist,tuple,dictanddataclass.num_caches – Number of recent output batches retained to mitigate allocator races across CUDA streams.
- Returns:
An object of the same type as the input, with CPU tensors transferred to CUDA.