class_docstr: The common FFN block.
  
  Args:
      in_channels (`int`):
          Number of input channels.
      hidden_channels (`int`):
          Number of hidden channels to connect conv2d layers.
      out_channels (`int`):
          Number of output channels.
      act_layer (`nn.Module`):
          Activation layer.
  
  Example:
      >>> import torch
      >>> from towhee.models.layers.ffn import FFNBlock
      >>>
      >>> x = torch.randn(1, 3, 1, 3)
      >>> layer = FFNBlock(in_channels=3, hidden_channels=2, out_channels=2)
      >>> y = layer(x)
      >>> print(y.shape)
      torch.Size([1, 2, 1, 3])
class_docstr_tok: ["The","common","FFN","block",".","Args",":","in_channels","(","`","int","`",")",":","Number","of","input","channels",".","hidden_channels","(","`","int","`",")",":","Number","of","hidden","channels","to","connect","conv2d","layers",".","out_channels","(","`","int","`",")",":","Number","of","output","channels",".","act_layer","(","`","nn.Module","`",")",":","Activation","layer",".","Example",":",">",">",">","import","torch",">",">",">","from","towhee.models.layers.ffn","import","FFNBlock",">",">",">",">",">",">","x","=","torch.randn","(","1",",","3",",","1",",","3",")",">",">",">","layer","=","FFNBlock","(","in_channels=3",",","hidden_channels=2",",","out_channels=2",")",">",">",">","y","=","layer","(","x",")",">",">",">","print","(","y.shape",")","torch.Size","(","[","1",",","2",",","1",",","3","]",")"]
code: def __init__(
      self,
      in_channels,
      hidden_channels=None,
      out_channels=None,
      act_layer=nn.GELU,
  ):
      super().__init__()
      out_features = out_channels or in_channels
      hidden_features = hidden_channels or in_channels
      self.ffn_fc1 = Conv2dBNActivation(
          in_channels,
          hidden_features,
          kernel_size=1,
          padding=0,
          stride=1,
          norm_layer=nn.BatchNorm2d,
          eps=1e-5,
      )
      self.ffn_fc2 = Conv2dBNActivation(
          hidden_features,
          out_features,
          kernel_size=1,
          padding=0,
          stride=1,
          norm_layer=nn.BatchNorm2d,
          eps=1e-5,
      )
      self.act = act_layer()
  
imports: from torch import nn
  from towhee.models.layers.conv_bn_activation import Conv2dBNActivation
label_desc: Use image node_id 1 to create a new FFNBlock object from inherited base classes: nn with example: obj = FFNBlock(in_channels, hidden_channels, out_channels, act_layer)