oneflow.utils.tensor.to_torch¶
-
oneflow.utils.tensor.
to_torch
(flow_tensor) → Tensor¶ Create a torch tensor from oneflow tensor.
The returned tensor and oneflow tensor share the same memory.
Note
Currently only local tensor is supported.
- Parameters
input (oneflow.Tensor) – Input Tensor
- Returns
torch.Tensor
For example:
import oneflow as flow import torch flow_t = flow.tensor([[1, 2, 3], [4, 5, 6]]) torch_t = flow.utils.tensor.to_torch(flow_t)
This feature
to_torch
is at Alpha Stage.