paddlespeech.vector.io.embedding_norm module

class paddlespeech.vector.io.embedding_norm.InputNormalization(mean_norm=True, std_norm=True, norm_type='global')[source]

Bases: object

Methods

__call__(x, lengths[, spk_ids, stop_gradient])

Returns the tensor with the surrounding context. Args: x (paddle.Tensor): A batch of tensors. lengths (paddle.Tensor): A batch of tensors containing the relative length of each sentence (e.g, [0.7, 0.9, 1.0]). It is used to avoid computing stats on zero-padded steps. spk_ids (paddle.Tensor, optional): tensor containing the ids of each speaker (e.g, [0 10 6]). It is used to perform per-speaker normalization when norm_type='speaker'. Defaults to paddle.to_tensor([], dtype="float32"). Returns: paddle.Tensor: The normalized feature or embedding.

save(path)

Save statistic dictionary.

to(device)

Puts the needed tensors in the right device.

save(path)[source]

Save statistic dictionary.

Args:

path (str): A path where to save the dictionary.

spk_dict_count: Dict[int, int]
spk_dict_mean: Dict[int, Tensor]
spk_dict_std: Dict[int, Tensor]
to(device)[source]

Puts the needed tensors in the right device.