paddlespeech.t2s.modules.geometry module
- paddlespeech.t2s.modules.geometry.shuffle_dim(x, axis, perm=None)[source]
Permute input tensor along aixs given the permutation or randomly.
- Args:
- x (Tensor):
The input tensor.
- axis (int):
The axis to shuffle.
- perm (List[int], ndarray, optional):
The order to reorder the tensor along the
axis
-th dimension. It is a permutation of[0, d)
, where d is the size of theaxis
-th dimension of the input tensor. If not provided, a random permutation is used. Defaults to None.
- Returns:
Tensor: The shuffled tensor, which has the same shape as x does.