espnet2.enh.loss.criterions.time_domain.TimeDomainLoss
espnet2.enh.loss.criterions.time_domain.TimeDomainLoss
class espnet2.enh.loss.criterions.time_domain.TimeDomainLoss(name, only_for_test=False, is_noise_loss=False, is_dereverb_loss=False)
Bases: AbsEnhLoss
, ABC
Base class for all time-domain Enhancement loss modules.
This class serves as a base for various time-domain loss functions used in speech enhancement tasks. It includes properties to specify the type of loss, whether it’s for testing, noise-related, or dereverberation-related.
name
The name of the loss function.
- Type: str
only_for_test
Flag indicating if the loss is only for testing.
- Type: bool
is_noise_loss
Flag indicating if the loss is related to noise.
- Type: bool
is_dereverb_loss
Flag indicating if the loss is related to dereverberation.
Type: bool
Parameters:
- name (str) – Name of the loss function.
- only_for_test (bool) – Optional; defaults to False.
- is_noise_loss (bool) – Optional; defaults to False.
- is_dereverb_loss (bool) – Optional; defaults to False.
Raises:ValueError – If both is_noise_loss and is_dereverb_loss are True at the same time, or if the name does not contain the appropriate suffix when is_noise_loss or is_dereverb_loss is set to True.
Examples
>>> loss = TimeDomainLoss(name="my_loss", is_noise_loss=True)
>>> print(loss.name) # Output: my_loss_noise
Initialize internal Module state, shared by both nn.Module and ScriptModule.
property is_dereverb_loss : bool
property is_noise_loss : bool
property name : str
property only_for_test : bool