PyTorch: Difference between revisions

22 bytes added ,  3 October 2021
Line 90: Line 90:
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:
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.permute <code>permute</code>]
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.permute <code>permute</code>]
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.expand <code>expand</code>] instead of [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.repeat <code>repeat</code>]
* [https://pytorch.org/docs/stable/generated/torch.Tensor.expand.html#torch.Tensor.expand <code>expand</code>] instead of [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.repeat <code>repeat</code>]
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.view <code>view</code>]
* [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.view <code>view</code>]