class_docstr: Implementation of the model H/ASP without batch normalization in speaker embedding. This model was proposed in: https://arxiv.org/abs/2009.14153
  Adapted from: https://github.com/clovaai/voxceleb_trainer
class_docstr_tok: ["Implementation","of","the","model","H\/ASP","without","batch","normalization","in","speaker","embedding",".","This","model","was","proposed","in",":","https",":","\/\/arxiv.org\/abs\/2009.14153","Adapted","from",":","https",":","\/\/github.com\/clovaai\/voxceleb_trainer"]
code: def __init__(
      self,
      input_dim=64,
      proj_dim=512,
      layers=[3, 4, 6, 3],
      num_filters=[32, 64, 128, 256],
      encoder_type="ASP",
      log_input=False,
      use_torch_spec=False,
      audio_config=None,
  ):
      super(ResNetSpeakerEncoder, self).__init__()
  
      self.encoder_type = encoder_type
      self.input_dim = input_dim
      self.log_input = log_input
      self.use_torch_spec = use_torch_spec
      self.audio_config = audio_config
      self.proj_dim = proj_dim
  
      self.conv1 = nn.Conv2d(
          1, num_filters[0], kernel_size=3, stride=1, padding=1
      )
      self.relu = nn.ReLU(inplace=True)
      self.bn1 = nn.BatchNorm2d(num_filters[0])
  
      self.inplanes = num_filters[0]
      self.layer1 = self.create_layer(
          SEBasicBlock, num_filters[0], layers[0]
      )
      self.layer2 = self.create_layer(
          SEBasicBlock, num_filters[1], layers[1], stride=(2, 2)
      )
      self.layer3 = self.create_layer(
          SEBasicBlock, num_filters[2], layers[2], stride=(2, 2)
      )
      self.layer4 = self.create_layer(
          SEBasicBlock, num_filters[3], layers[3], stride=(2, 2)
      )
  
      self.instancenorm = nn.InstanceNorm1d(input_dim)
  
      if self.use_torch_spec:
          self.torch_spec = self.get_torch_mel_spectrogram_class(
              audio_config
          )
      else:
          self.torch_spec = None
  
      outmap_size = int(self.input_dim / 8)
  
      self.attention = nn.Sequential(
          nn.Conv1d(num_filters[3] * outmap_size, 128, kernel_size=1),
          nn.ReLU(),
          nn.BatchNorm1d(128),
          nn.Conv1d(128, num_filters[3] * outmap_size, kernel_size=1),
          nn.Softmax(dim=2),
      )
  
      if self.encoder_type == "SAP":
          out_dim = num_filters[3] * outmap_size
      elif self.encoder_type == "ASP":
          out_dim = num_filters[3] * outmap_size * 2
      else:
          raise ValueError("Undefined encoder")
  
      self.fc = nn.Linear(out_dim, proj_dim)
  
      self._init_layers()
  
file_path: TTS/TTS/encoder/models/resnet.py
imports: import torch
  from torch import nn
  from TTS.encoder.models.base_encoder import BaseEncoder
label_desc: Use image node_id 1 to create a new ResNetSpeakerEncoder object from inherited base classes: BaseEncoder with example: obj = ResNetSpeakerEncoder(input_dim, proj_dim, layers, num_filters, encoder_type, log_input, use_torch_spec, audio_config)