class_docstr: convolutional discriminator for UASR.
code: def forward(
      self, x: torch.Tensor, padding_mask: Optional[torch.Tensor]
  ):
      assert check_argument_types()
  
      # (Batch, Time, Channel) -> (Batch, Channel, Time)
      x = x.transpose(1, 2)
  
      x = self.net(x)
  
      # (Batch, Channel, Time) -> (Batch, Time, Channel)
      x = x.transpose(1, 2)
      x_sz = x.size(1)
      if (
          padding_mask is not None
          and padding_mask.any()
          and padding_mask.dim() > 1
      ):
          padding_mask = padding_mask[:, : x.size(1)]
          padding_mask.to(x.device)
          x[padding_mask] = float("-inf") if self.max_pool else 0
          x_sz = x_sz - padding_mask.sum(dim=-1)
  
      x = x.squeeze(-1)
      if self.max_pool:
          x, _ = x.max(dim=-1)
      else:
          x = x.sum(dim=-1)
          x = x / x_sz
  
      return x
  
file_path: espnet/espnet2/uasr/discriminator/conv_discriminator.py
imports: import argparse
  from typing import Dict, Optional
  import torch
  from typeguard import check_argument_types
  from espnet2.uasr.discriminator.abs_discriminator import AbsDiscriminator
  from espnet2.utils.types import str2bool
label_desc: Use image node_id 2 for calling the ConvDiscriminator obj's underlying member method code with example usage: obj.forward(x, padding_mask) and returns: x