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
Explore this link on the map →