zero.hardware.to_device

zero.hardware.to_device(data, device, non_blocking=False)[source]

Move tensor(s) to device.

Move data consisting of tensors to the given device using torch.Tensor.to.

Parameters
Returns

The same data, but moved to the given device.

Return type

Recursive[torch.Tensor]

Examples

to_device(torch.tensor(0), 'cpu')
to_device({'a': torch.tensor(0), 'b': [(torch.tensor(0),)]}, 'cpu')