to_tensor#
- obsidian.parameters.targets.to_tensor(f: Any, dtype: dtype = torch.float64, device: device | str | int | None = None) Tensor[source]#
Validate and convert f to a torch.Tensor. Accepts: torch.Tensor, numpy.ndarray, pandas Series/DataFrame, Python scalar (int/float), or list/tuple of numerics.
- Parameters:
f – input to convert
dtype – optional torch dtype for the resulting tensor
device – optional torch device for the resulting tensor
- Returns:
torch.Tensor