espnet2.cls.espnet_model.label_to_onehot
Less than 1 minute
espnet2.cls.espnet_model.label_to_onehot
espnet2.cls.espnet_model.label_to_onehot(label: Tensor, label_lengths: Tensor, vocab_size: int, classification_type: str, lsm_weight: float = 0.0) → Tensor
Convert label to onehot. Args
label: (Batch, Length) pad value should be -1 label_lengths: (Batch,) only used in asserts vocab_size: int classification_type: str “multi-class” or “multi-label” lsm_weight: float, label smoothing weight
Returns : onehot: (Batch, Length, vocab_size)