5,323
edits
(→Memory) |
(→Memory) |
||
Line 81: | Line 81: | ||
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> | * [https://pytorch.org/docs/stable/tensors.html#torch.Tensor.expand <code>expand</code>] instead of <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>] | ||