Rate this Page

torch.nn.utils.rnn.invert_permutation#

torch.nn.utils.rnn.invert_permutation(permutation)[source]#

Returns the inverse ofpermutation.

This is useful for converting between sorted and unsorted indices inaPackedSequence.

Parameters

permutation (Tensor,optional) – a 1-D tensor of indices to invert

Return type

Optional[Tensor]