torch.reshape — PyTorch 2.12 documentation
Returns a tensor with the same data and number of elements as input, but with the specified shape. When possible, the returned tensor will be a view of input. Otherwise, it will be a copy. Contiguous inputs and inputs with compatible strides can be reshaped without copying, but you should not depend on the copying vs. viewing behavior. See torch.Tensor.view() on when it is possible to return a view. A single dimension may be -1, in which case it’s inferred from the remaining dimensions and the number of elements in input. input (Tensor) – the tensor to be reshaped shape (tuple of int) – the new shape Example: Previous torch.permute Next torch.row_stack Built with the PyData Sphinx Theme 0.15.4. previous torch.permute next torch.row_stack Access comprehensive developer documentation for PyTorch Get in-depth tutorials for beginners and advanced developers Find development resources and get your questions answered Stay in touch for updates, event info, and the latest news By submitting th
torch.reshape # torch. reshape ( input , shape ) → Tensor # Returns a tensor with the same data and number of elements as input , but with the specified shape. When possible, the returned tensor will be a view of input . Otherwise, it will be a copy. Contiguous inputs and inputs with compatible strides can be reshaped without copying, but you should not depend on the copying vs. viewing behavior. See torch.Tensor.view() on when it is possible to return a view. A single dimension may be -1, in which case it’s inferred from the remaining dimensions and the number of elements in input . Pa
Explore this link on the map →related reading
- Redirecting…docs.pytorch.org
- PyTorch internals : ezyang's blogblog.ezyang.com
- torch.Tensor — PyTorch 2.12 documentationdocs.pytorch.org
- torch.ones_like — PyTorch 2.12 documentationdocs.pytorch.org
- Tensors — PyTorch Tutorials 2.12.0+cu130 documentationpytorch.org
- torch.stack — PyTorch 2.12 documentationdocs.pytorch.org
- torch.index_select — PyTorch 2.12 documentationdocs.pytorch.org
- torch.zeros_like — PyTorch 2.12 documentationdocs.pytorch.org
- Chapter 0: Fundamentals - ARENAlearn.arena.education
- Tensors — PyTorch Tutorials 2.13.0+cu130 documentationdocs.pytorch.org
- torch.empty — PyTorch 2.12 documentationdocs.pytorch.org
- the bug that taught me more about PyTorch than years of using it | Elana Simonelanapearl.github.io