gwexpy.interop.torch_#
Interoperability with PyTorch tensors.
Functions
|
Create a TimeSeries from a PyTorch tensor. |
|
Convert a series to a PyTorch tensor. |
- gwexpy.interop.torch_.to_torch(series: TimeSeries | Any, device: str | torch.device | None = None, dtype: torch.dtype | None = None, requires_grad: bool = False, copy: bool = False) torch.Tensor#
Convert a series to a PyTorch tensor.
- パラメータ:
series (TimeSeries or array-like) -- Input data.
device (str or torch.device, optional) -- Target device.
dtype (torch.dtype, optional) -- Target dtype.
requires_grad (bool, optional) -- Whether to track gradients.
copy (bool, optional) -- If True, always copy data; otherwise share memory if possible.
- 戻り値:
The converted tensor.
- 戻り値の型:
torch.Tensor