class_docstr: CNN Block, based on VGG blocks.
  
  Arguments
  ---------
  input_shape : tuple
      Expected shape of the input.
  channels : int
      Number of convolutional channels for the block.
  kernel_size : tuple
      Size of the 2d convolutional kernel
  activation : torch.nn.Module class
      A class to be used for instantiating an activation layer.
  using_2d_pool : bool
      Whether to use 2d pooling or only 1d pooling.
  pooling_size : int
      Size of pooling kernel, duplicated for 2d pooling.
  dropout : float
      Rate to use for dropping channels.
  
  Example
  -------
  >>> inputs = torch.rand(10, 15, 60)
  >>> block = CNN_Block(input_shape=inputs.shape, channels=32)
  >>> outputs = block(inputs)
  >>> outputs.shape
  torch.Size([10, 15, 30, 32])
class_docstr_tok: ["CNN","Block",",","based","on","VGG","blocks",".","Arguments","--","--","--","--","-","input_shape",":","tuple","Expected","shape","of","the","input",".","channels",":","int","Number","of","convolutional","channels","for","the","block",".","kernel_size",":","tuple","Size","of","the","2d","convolutional","kernel","activation",":","torch.nn.Module","class","A","class","to","be","used","for","instantiating","an","activation","layer",".","using_2d_pool",":","bool","Whether","to","use","2d","pooling","or","only","1d","pooling",".","pooling_size",":","int","Size","of","pooling","kernel",",","duplicated","for","2d","pooling",".","dropout",":","float","Rate","to","use","for","dropping","channels",".","Example","--","--","--","-",">",">",">","inputs","=","torch.rand","(","10",",","15",",","60",")",">",">",">","block","=","CNN_Block","(","input_shape=inputs.shape",",","channels=32",")",">",">",">","outputs","=","block","(","inputs",")",">",">",">","outputs.shape","torch.Size","(","[","10",",","15",",","30",",","32","]",")"]
code: def __init__(
      self,
      input_shape,
      channels,
      kernel_size=[3, 3],
      activation=torch.nn.LeakyReLU,
      using_2d_pool=False,
      pooling_size=2,
      dropout=0.15,
  ):
      super().__init__(input_shape=input_shape)
      self.append(
          sb.nnet.CNN.Conv2d,
          out_channels=channels,
          kernel_size=kernel_size,
          layer_name="conv_1",
      )
      self.append(sb.nnet.normalization.LayerNorm, layer_name="norm_1")
      self.append(activation(), layer_name="act_1")
      self.append(
          sb.nnet.CNN.Conv2d,
          out_channels=channels,
          kernel_size=kernel_size,
          layer_name="conv_2",
      )
      self.append(sb.nnet.normalization.LayerNorm, layer_name="norm_2")
      self.append(activation(), layer_name="act_2")
  
      if using_2d_pool:
          self.append(
              sb.nnet.pooling.Pooling2d(
                  pool_type="max",
                  kernel_size=(pooling_size, pooling_size),
                  pool_axis=(1, 2),
              ),
              layer_name="pooling",
          )
      else:
          self.append(
              sb.nnet.pooling.Pooling1d(
                  pool_type="max",
                  input_dims=4,
                  kernel_size=pooling_size,
                  pool_axis=2,
              ),
              layer_name="pooling",
          )
  
      self.append(
          sb.nnet.dropout.Dropout2d(drop_rate=dropout),
          layer_name="drop",
      )
  
file_path: speechbrain/speechbrain/lobes/models/CRDNN.py
imports: import torch
  import speechbrain
label_desc: Use image node_id 1 to create a new CNN_Block object from inherited base classes: sb.nnet.containers with example: obj = CNN_Block(input_shape, channels, kernel_size, activation, using_2d_pool, pooling_size, dropout)