tensor — Model Optimizer 0.29.0 (original) (raw)
Utility functions for PyTorch tensors.
Functions
torch_to | Try to recursively move the data to the specified args/kwargs. |
---|---|
torch_detach | Try to recursively detach the data from the computation graph. |
torch_to_numpy | Convert torch tensors to numpy arrays. |
numpy_to_torch | 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_]