espnet2.spk.encoder.resnet_encoder.ResNetEncoder
espnet2.spk.encoder.resnet_encoder.ResNetEncoder
class espnet2.spk.encoder.resnet_encoder.ResNetEncoder(input_size: int, block: ~typing.Type[~torch.nn.modules.module.Module] = <class 'espnet2.spk.layers.resnet_block.BasicBlock'>, num_blocks: tuple = (2, 2, 2, 2), m_channels: int = 32, resnet_type: str | None = None)
Bases: AbsEncoder
ResNet Encoder. Extracts frame-level ResNet embeddings from
mel-filterbank energy or MFCC features. Paper: K. He et al., “Deep Residual Learning for Image Recognition”, Adapted from https://github.com/wenet-e2e/wespeaker/blob/master/we -speaker/models/resnet.py
- Parameters:
- input_size – input feature dimension.
- block – type of encoder block class, either BasicBlock or Bottleneck.
- num_blocks – number of blocks in each layer.
- m_channels – number of channels in the first convolution layer.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(x: Tensor, **kwargs) → Tensor
Defines the computation performed at every call.
Should be overridden by all subclasses.
NOTE
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
output_size() → int