spyrit.core.torch.sequency_perm
- spyrit.core.torch.sequency_perm(X, ind=None)[source]
Permute the last dimension of a tensor. By defaults this allows the sequency order to be obtained from the natural order.
- Args:
X(torch.tensor): input of shape (*,n)ind: list of index length n. Defaults to indices to get sequency order.- Returns:
torch.tensor: output of shape (*,n).
- Note:
Same as
spyrit.misc.walsh_hadamard.sequency_perm()for torch tensors.- Example :
>>> import torch >>> import spyrit.core.torch as st >>> x = torch.tensor([1, 3, 0, -1, 7, 5, 1, -2]) >>> x = x[None, None, :] >>> x = st.sequency_perm(x) >>> print(x) tensor([[[ 1, 7, 1, 0, -1, -2, 5, 3]]]) >>> print(x.shape) torch.Size([1, 1, 8])