torch.index_select — PyTorch 2.12 documentation
The returned tensor has the same number of dimensions as the original tensor (input). The dimth dimension has the same size as the length of index; other dimensions have the same size as in the original tensor. Note The returned tensor does not use the same storage as the original tensor. If out has a different shape than expected, we silently change it to the correct shape, reallocating the underlying storage if necessary. input (Tensor) – the input tensor. dim (int) – the dimension in which we index index (IntTensor or LongTensor) – the 1-D tensor containing the indices to index out (Tensor, optional) – the output tensor. Example: Previous torch.index_reduce Next torch.masked_select Built with the PyData Sphinx Theme 0.15.4. previous torch.index_reduce next torch.masked_select 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
torch.index_select # torch. index_select ( input , dim , index , * , out = None ) → Tensor # Returns a new tensor which indexes the input tensor along dimension dim using the entries in index . The returned tensor has the same number of dimensions as the original tensor ( input ). The dim th dimension has the same size as the length of index ; other dimensions have the same size as in the original tensor. Note The returned tensor does not use the same storage as the original tensor. If out has a different shape than expected, we silently change it to the correct shape, reallocating the
Explore this link on the map →related reading
- PyTorch internals : ezyang's blogblog.ezyang.com
- torch.Tensor — PyTorch 2.12 documentationdocs.pytorch.org
- torch.where — PyTorch 2.12 documentationdocs.pytorch.org
- torch_geometric.utils - pytorch_geometric documentationpytorch-geometric.readthedocs.io
- torch.reshape — PyTorch 2.12 documentationdocs.pytorch.org
- Tensors — PyTorch Tutorials 2.12.0+cu130 documentationpytorch.org
- torch.stack — PyTorch 2.12 documentationdocs.pytorch.org
- Redirecting…docs.pytorch.org
- Chapter 0: Fundamentals - ARENAlearn.arena.education
- Tensor Considered Harmfulnlp.seas.harvard.edu
- Tensors — PyTorch Tutorials 2.13.0+cu130 documentationdocs.pytorch.org
- torch.ones_like — PyTorch 2.12 documentationdocs.pytorch.org