class_docstr: Convolutional Spatial Gating Unit module definition.
  
  Args:
      size: Initial size to determine the number of channels.
      kernel_size: Size of the convolving kernel.
      norm_class: Normalization module class.
      norm_args: Normalization module arguments.
      dropout_rate: Dropout rate.
      causal: Whether to use causal convolution (set to True if streaming).
class_docstr_tok: ["Convolutional","Spatial","Gating","Unit","module","definition",".","Args",":","size",":","Initial","size","to","determine","the","number","of","channels",".","kernel_size",":","Size","of","the","convolving","kernel",".","norm_class",":","Normalization","module","class",".","norm_args",":","Normalization","module","arguments",".","dropout_rate",":","Dropout","rate",".","causal",":","Whether","to","use","causal","convolution","(","set","to","True","if","streaming",")","."]
docstr: Construct a ConvolutionalSpatialGatingUnit object.
docstr_tok: ["Construct","a","ConvolutionalSpatialGatingUnit","object","."]
code: def __init__(
      self,
      size: int,
      kernel_size: int,
      norm_class: torch.nn.Module = torch.nn.LayerNorm,
      norm_args: Dict = {},
      dropout_rate: float = 0.0,
      causal: bool = False,
  ) -> None:
      """Construct a ConvolutionalSpatialGatingUnit object."""
      super().__init__()
  
      channels = size // 2
  
      self.kernel_size = kernel_size
  
      if causal:
          self.lorder = kernel_size - 1
          padding = 0
      else:
          self.lorder = 0
          padding = (kernel_size - 1) // 2
  
      self.conv = torch.nn.Conv1d(
          channels,
          channels,
          kernel_size,
          stride=1,
          padding=padding,
          groups=channels,
      )
  
      self.norm = norm_class(channels, **norm_args)
      self.activation = torch.nn.Identity()
  
      self.dropout = torch.nn.Dropout(dropout_rate)
  
file_path: espnet/espnet2/asr_transducer/encoder/modules/convolution.py
imports: from typing import Dict, Optional, Tuple
  import torch
label_desc: Use image node_id 1 to create a new ConvolutionalSpatialGatingUnit object from inherited base classes: torch.nn with example: obj = ConvolutionalSpatialGatingUnit(size, kernel_size, norm_class, norm_args, dropout_rate, causal)