tensor
Utility functions for PyTorch tensors.
Functions
Try to recursively move the data to the specified args/kwargs. |
|
Try to recursively detach the data from the computation graph. |
|
Convert torch tensors to numpy arrays. |
|
Convert numpy arrays to torch tensors. |
- numpy_to_torch(np_outputs)
Convert numpy arrays to torch tensors.
- Parameters:
np_outputs (List[ndarray]) –
- Return type:
List[Tensor]
- torch_detach(data)
Try to recursively detach the data from the computation graph.
- torch_to(data, *args, **kwargs)
Try to recursively move the data to the specified args/kwargs.
- torch_to_numpy(inputs)
Convert torch tensors to numpy arrays.
- Parameters:
inputs (List[Tensor]) –
- Return type:
List[ndarray]