class_docstr: A PyTorch module for the Encoder part of DAC.
  
  Parameters
  ----------
  d_model : int, optional
      The initial dimensionality of the model. Default is 64.
  strides : list, optional
      A list of stride values for downsampling in each EncoderBlock. Default is [2, 4, 8, 8].
  d_latent : int, optional
      The dimensionality of the output latent space. Default is 64.
  
  Example
  -------
  Creating an Encoder instance
  >>> encoder = Encoder()
  >>> audio_input = torch.randn(1, 1, 44100) # Example shape: [Batch, Channels, Time]
  >>> continuous_embedding = encoder(audio_input)
  
  Using a pretrained encoder.
  
  >>> dac = DAC(load_pretrained=True, model_type="44KHz", model_bitrate="8kbps", tag="latest")
  >>> encoder = dac.encoder
  >>> audio_input = torch.randn(1, 1, 44100) # Example shape: [Batch, Channels, Time]
  >>> continuous_embeddings = encoder(audio_input)
class_docstr_tok: ["A","PyTorch","module","for","the","Encoder","part","of","DAC",".","Parameters","--","--","--","--","--","d_model",":","int",",","optional","The","initial","dimensionality","of","the","model",".","Default","is","64.","strides",":","list",",","optional","A","list","of","stride","values","for","downsampling","in","each","EncoderBlock",".","Default","is","[","2",",","4",",","8",",","8","]",".","d_latent",":","int",",","optional","The","dimensionality","of","the","output","latent","space",".","Default","is","64",".","Example","--","--","--","-","Creating","an","Encoder","instance",">",">",">","encoder","=","Encoder","(",")",">",">",">","audio_input","=","torch.randn","(","1",",","1",",","44100",")","#","Example","shape",":","[","Batch",",","Channels",",","Time","]",">",">",">","continuous_embedding","=","encoder","(","audio_input",")","Using","a","pretrained","encoder",".",">",">",">","dac","=","DAC","(","load_pretrained=True",",","model_type=","''","44KHz","''",",","model_bitrate=","''","8kbps","''",",","tag=","''","latest","''",")",">",">",">","encoder","=","dac.encoder",">",">",">","audio_input","=","torch.randn","(","1",",","1",",","44100",")","#","Example","shape",":","[","Batch",",","Channels",",","Time","]",">",">",">","continuous_embeddings","=","encoder","(","audio_input",")"]
docstr: Initializes the Encoder
  
  Parameters
  ----------
  d_model : int, optional, by default 64
  strides : list, optional, by default [2, 4, 8, 8]
  d_latent : int, optional, by default 64
docstr_tok: ["Initializes","the","Encoder","Parameters","--","--","--","--","--","d_model",":","int",",","optional",",","by","default","64","strides",":","list",",","optional",",","by","default","[","2",",","4",",","8",",","8","]","d_latent",":","int",",","optional",",","by","default","64"]
code: def __init__(
      self,
      d_model: int = 64,
      strides: list = [2, 4, 8, 8],
      d_latent: int = 64,
  ):
      """
      Initializes the Encoder
  
      Parameters
      ----------
      d_model : int, optional, by default 64
      strides : list, optional, by default [2, 4, 8, 8]
      d_latent : int, optional, by default 64
      """
      super().__init__()
      # Create first convolution
      self.block = [WNConv1d(1, d_model, kernel_size=7, padding=3)]
  
      # Create EncoderBlocks that double channels as they downsample by `stride`
      for stride in strides:
          d_model *= 2
          self.block += [EncoderBlock(d_model, stride=stride)]
  
      # Create last convolution
      self.block += [
          Snake1d(d_model),
          WNConv1d(d_model, d_latent, kernel_size=3, padding=1),
      ]
  
      # Wrap black into nn.Sequential
      self.block = nn.Sequential(*self.block)
      self.enc_dim = d_model
  
imports: import math
  from pathlib import Path
  from typing import List, Union
  import logging
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.utils.parametrizations import weight_norm
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(d_model, strides, d_latent)