class_docstr: This class implements the convolutional block used in CNN14
  
  Arguments
  ---------
  in_channels : int
      Number of input channels
  out_channels : int
      Number of output channels
  norm_type : str in ['bn', 'in', 'ln']
      The type of normalization
  
  Example:
  --------
  >>> convblock = ConvBlock(10, 20, 'ln')
  >>> x = torch.rand(5, 10, 20, 30)
  >>> y = convblock(x)
  >>> print(y.shape)
  torch.Size([5, 20, 10, 15])
class_docstr_tok: ["This","class","implements","the","convolutional","block","used","in","CNN14","Arguments","--","--","--","--","-","in_channels",":","int","Number","of","input","channels","out_channels",":","int","Number","of","output","channels","norm_type",":","str","in","[","'bn","'",",","'in","'",",","'ln","'","]","The","type","of","normalization","Example",":","--","--","--","--",">",">",">","convblock","=","ConvBlock","(","10",",","20",",","'ln","'",")",">",">",">","x","=","torch.rand","(","5",",","10",",","20",",","30",")",">",">",">","y","=","convblock","(","x",")",">",">",">","print","(","y.shape",")","torch.Size","(","[","5",",","20",",","10",",","15","]",")"]
docstr: The forward pass for convblocks in CNN14
  
  Arguments:
  ----------
  x : torch.Tensor
      input tensor with shape B x C_in x D1 x D2
  where B = Batchsize
        C_in = Number of input channel
        D1 = Dimensionality of the first spatial dim
        D2 = Dimensionality of the second spatial dim
  pool_size : tuple with integer values
      Amount of pooling at each layer
  pool_type : str in ['max', 'avg', 'avg+max']
      The type of pooling
docstr_tok: ["The","forward","pass","for","convblocks","in","CNN14","Arguments",":","--","--","--","--","--","x",":","torch.Tensor","input","tensor","with","shape","B","x","C_in","x","D1","x","D2","where","B","=","Batchsize","C_in","=","Number","of","input","channel","D1","=","Dimensionality","of","the","first","spatial","dim","D2","=","Dimensionality","of","the","second","spatial","dim","pool_size",":","tuple","with","integer","values","Amount","of","pooling","at","each","layer","pool_type",":","str","in","[","'max","'",",","'avg","'",",","'avg+max","'","]","The","type","of","pooling"]
code: def forward(self, x, pool_size=(2, 2), pool_type="avg"):
      """The forward pass for convblocks in CNN14
  
      Arguments:
      ----------
      x : torch.Tensor
          input tensor with shape B x C_in x D1 x D2
      where B = Batchsize
            C_in = Number of input channel
            D1 = Dimensionality of the first spatial dim
            D2 = Dimensionality of the second spatial dim
      pool_size : tuple with integer values
          Amount of pooling at each layer
      pool_type : str in ['max', 'avg', 'avg+max']
          The type of pooling
      """
  
      x = F.relu_(self.norm1(self.conv1(x)))
      x = F.relu_(self.norm2(self.conv2(x)))
      if pool_type == "max":
          x = F.max_pool2d(x, kernel_size=pool_size)
      elif pool_type == "avg":
          x = F.avg_pool2d(x, kernel_size=pool_size)
      elif pool_type == "avg+max":
          x1 = F.avg_pool2d(x, kernel_size=pool_size)
          x2 = F.max_pool2d(x, kernel_size=pool_size)
          x = x1 + x2
      else:
          raise Exception("Incorrect pooling type!")
      return x
  
file_path: speechbrain/speechbrain/lobes/models/Cnn14.py
imports: import torch.nn
  import torch.nn.functional
  import torch
label_desc: Use image node_id 3 for calling the ConvBlock obj's underlying member method code with example usage: obj.forward(x, pool_size, pool_type) and returns: x