def permute_hidden(self, hx, permutation): if permutation is None: return hx h = apply_permutation(hx[0], permutation) c = apply_permutation(hx[1], permutation) return h, c
def permute_hidden(self, hx, permutation): # type: (Tuple[torch.Tensor, torch.Tensor], Optional[torch.Tensor]) -> Tuple[torch.Tensor, torch.Tensor] if permutation is None: return hx return apply_permutation(hx[0], permutation), apply_permutation( hx[1], permutation)