Jump to content

PyTorch: Difference between revisions

1 byte removed ,  6 October 2020
Line 74: Line 74:
* [https://pytorch.org/docs/stable/autograd.html#torch.Tensor.detach <code>detach()</code> ]deletes the item from the autograd edge.
* [https://pytorch.org/docs/stable/autograd.html#torch.Tensor.detach <code>detach()</code> ]deletes the item from the autograd edge.
* [https://pytorch.org/docs/stable/tensors.html?highlight=cpu#torch.Tensor.cpu <code>cpu()</code>] moves the tensor to the CPU.
* [https://pytorch.org/docs/stable/tensors.html?highlight=cpu#torch.Tensor.cpu <code>cpu()</code>] moves the tensor to the CPU.
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.numpy <code>numpy()</code>] returns the underlying numpy tensor.
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.numpy <code>numpy()</code>] returns a numpy view of the tensor.


When possible, use functions which return new views of existing tensors rather than making duplicates of tensors:
When possible, use functions which return new views of existing tensors rather than making duplicates of tensors: