code: def __init__(
      self,
      in_channels,
      out_channels,
      kernel_size,
      stride=1,
      padding=0,
      dilation=1,
      groups=1,
      heads=-1,
      bias=False,
      use_mask=True,
      quantize=False,
  ):
      super(MaskedConv1d, self).__init__()
  
      if not (heads == -1 or groups == in_channels):
          raise ValueError("Only use heads for depthwise convolutions")
  
      self.real_out_channels = out_channels
      if heads != -1:
          in_channels = heads
          out_channels = heads
          groups = heads
  
      # preserve original padding
      self._padding = padding
  
      # if padding is a tuple/list, it is considered as asymmetric padding
      if type(padding) in (tuple, list):
          self.pad_layer = nn.ConstantPad1d(padding, value=0.0)
          # reset padding for conv since pad_layer will handle this
          padding = 0
      else:
          self.pad_layer = None
  
      if PYTORCH_QUANTIZATION_AVAILABLE and quantize:
          self.conv = quant_nn.QuantConv1d(
              in_channels,
              out_channels,
              kernel_size,
              stride=stride,
              padding=padding,
              dilation=dilation,
              groups=groups,
              bias=bias,
          )
      elif not PYTORCH_QUANTIZATION_AVAILABLE and quantize:
          raise ImportError(
              "pytorch-quantization is not installed. Install from "
              "https://github.com/NVIDIA/TensorRT/tree/master/tools/pytorch-quantization."
          )
      else:
          self.conv = nn.Conv1d(
              in_channels,
              out_channels,
              kernel_size,
              stride=stride,
              padding=padding,
              dilation=dilation,
              groups=groups,
              bias=bias,
          )
      self.use_mask = use_mask
      self.heads = heads
  
      # Calculations for "same" padding cache
      self.same_padding = (self.conv.stride[0] == 1) and (
          2 * self.conv.padding[0]
          == self.conv.dilation[0] * (self.conv.kernel_size[0] - 1)
      )
      if self.pad_layer is None:
          self.same_padding_asymmetric = False
      else:
          self.same_padding_asymmetric = (
              self.conv.stride[0] == 1
          ) and (
              sum(self._padding)
              == self.conv.dilation[0] * (self.conv.kernel_size[0] - 1)
          )
  
      # `self.lens` caches consecutive integers from 0 to `self.max_len` that are used to compute the mask for a
      # batch. Recomputed to bigger size as needed. Stored on a device of the latest batch lens.
      if self.use_mask:
          self.max_len = torch.tensor(0)
          self.lens = torch.tensor(0)
  
imports: import math
  from typing import Callable, Iterable, List, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from torch.nn.init import _calculate_correct_fan
  from torch.nn.modules.utils import _single
  from nemo.collections.common.parts.utils import activation_registry
  from nemo.core.classes.mixins import AccessMixin
  from nemo.core.classes.mixins.adapter_mixins import AdapterModuleMixin
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new MaskedConv1d object from inherited base classes: nn with example: obj = MaskedConv1d(in_channels, out_channels, kernel_size, stride, padding, dilation, groups, heads, bias, use_mask, quantize)