class_docstr: convolutional generator for UASR.
class_docstr_tok: ["convolutional","generator","for","UASR","."]
code: def __init__(
      self,
      input_dim: int,
      output_dim: int,
      cfg: Optional[Dict] = None,
      conv_kernel: int = 3,
      conv_dilation: int = 1,
      conv_stride: int = 9,
      pad: int = -1,
      bias: str2bool = False,
      dropout: float = 0.0,
      batch_norm: str2bool = True,
      batch_norm_weight: float = 30.0,
      residual: str2bool = True,
  ):
      super().__init__()
      assert check_argument_types()
  
      self.input_dim = input_dim
      self.output_dim = output_dim
  
      if cfg is not None:
          cfg = argparse.Namespace(**cfg)
          self.conv_kernel = cfg.generator_kernel
          self.conv_dilation = cfg.generator_dilation
          self.conv_stride = cfg.generator_stride
          self.pad = cfg.generator_pad
          self.bias = cfg.generator_bias
          self.dropout = torch.nn.Dropout(cfg.generator_dropout)
          # TODO(Dongji): batch_norm is not in cfg
          self.batch_norm = False
          self.batch_norm_weight = cfg.generator_batch_norm
          self.residual = cfg.generator_residual
      else:
          self.conv_kernel = conv_kernel
          self.conv_dilation = conv_dilation
          self.conv_stride = conv_stride
          self.output_dim = output_dim
          self.pad = pad
          self.bias = bias
          self.dropout = torch.nn.Dropout(dropout)
          self.batch_norm = batch_norm
          self.batch_norm_weight = batch_norm_weight
          self.residual = residual
  
      if self.pad < 0:
          self.padding = self.conv_kernel // 2
      else:
          self.padding = self.pad
  
      self.proj = torch.nn.Sequential(
          TransposeLast(),
          torch.nn.Conv1d(
              input_dim,
              output_dim,
              kernel_size=self.conv_kernel,
              stride=self.conv_stride,
              dilation=self.conv_dilation,
              padding=self.padding,
              bias=self.bias,
          ),
          TransposeLast(),
      )
      if self.batch_norm:
          self.bn = torch.nn.BatchNorm1d(input_dim)
          self.bn.weight.data.fill_(self.batch_norm_weight)
      if self.residual:
          self.in_proj = torch.nn.Linear(input_dim, input_dim)
  
imports: import argparse
  import logging
  from typing import Dict, Optional
  import torch
  from typeguard import check_argument_types
  from espnet2.uasr.generator.abs_generator import AbsGenerator
  from espnet2.utils.types import str2bool
label_desc: Use image node_id 1 to create a new ConvGenerator object from inherited base classes: AbsGenerator with example: obj = ConvGenerator(input_dim, output_dim, cfg, conv_kernel, conv_dilation, conv_stride, pad, bias, dropout, batch_norm, batch_norm_weight, residual)