to_tensor

to_tensor(x: Any) torch.Tensor[source]

Convert data to tensor and put on default device.

Parameters

x (Any) – Initial data for the tensor. Can be a list, tuple, NumPy ndarray, scalar, and other types.

Returns

Input data as tensor.

Return type

torch.Tensor