torch.unravel_index — PyTorch 2.11 documentation
Converts a tensor of flat indices into a tuple of coordinate tensors that index into an arbitrary tensor of the specified shape. indices (Tensor) – An integer tensor containing indices into the flattened version of an arbitrary tensor of shape shape. All elements must be in the range [0, prod(shape) - 1]. shape (int, sequence of ints, or torch.Size) – The shape of the arbitrary tensor. All elements must be non-negative. Each i-th tensor in the output corresponds with dimension i of shape. Each tensor has the same shape as indices and contains one index into dimension i for each of the flat indices given by indices. tuple of Tensors Example: Previous torch.unbind Next torch.unsqueeze Built with the PyData Sphinx Theme 0.15.4. previous torch.unbind next torch.unsqueeze 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 th
Rate this Page ★ ★ ★ ★ ★ torch.unravel_index(indices, shape)[source]# Converts a tensor of flat indices into a tuple of coordinate tensors that index into an arbitrary tensor of the specified shape. Parameters: indices (Tensor) – An integer tensor containing indices into the flattened version of an arbitrary tensor of shape shape. All elements must be in the range [0, prod(shape) - 1]. shape (int, sequence of ints, or torch.Size) – The shape of the arbitrary tensor. All elements must be non-negative. Returns: Each i-th tensor in the output corresponds with dimension i of shape.…
saved by
related reading
- torch.index_select — PyTorch 2.12 documentationdocs.pytorch.org
- torch.reshape — PyTorch 2.12 documentationdocs.pytorch.org
- GitHub - srush/Tensor-Puzzles: Solve puzzles. Improve your pytorch.github.com
- PyTorch internals : ezyang's blogblog.ezyang.com
- torch.stackdocs.pytorch.org
- torch_geometric.utils - pytorch_geometric documentationpytorch-geometric.readthedocs.io
- numpy.ravel — NumPy v2.5 Manualnumpy.org
- python - How to convert a PyTorch sparse_coo_tensor into a PyTorch dense tensor? - Stack Overflowstackoverflow.com
- Chapter 0: Fundamentals - ARENAlearn.arena.education
- torch.Tensor.expanddocs.pytorch.org
- torch.Tensor — PyTorch 2.12 documentationdocs.pytorch.org
- Tensor Considered Harmfulnlp.seas.harvard.edu