class_docstr: This corresponds to the 'PoolFormerBlock' class in the original implementation.
class_docstr_tok: ["This","corresponds","to","the","'PoolFormerBlock","'","class","in","the","original","implementation","."]
code: def __init__(
      self,
      config,
      num_channels,
      pool_size,
      hidden_size,
      intermediate_size,
      drop_path,
  ):
      super().__init__()
      self.pooling = PoolFormerPooling(pool_size)
      self.output = PoolFormerOutput(
          config, drop_path, hidden_size, intermediate_size
      )
      self.before_norm = PoolFormerGroupNorm(num_channels)
      self.after_norm = PoolFormerGroupNorm(num_channels)
  
      # Useful for training neural nets
      self.drop_path = (
          PoolFormerDropPath(drop_path)
          if drop_path > 0.0
          else nn.Identity()
      )
      self.use_layer_scale = config.use_layer_scale
      if config.use_layer_scale:
          self.layer_scale_1 = nn.Parameter(
              config.layer_scale_init_value
              * torch.ones((num_channels)),
              requires_grad=True,
          )
          self.layer_scale_2 = nn.Parameter(
              config.layer_scale_init_value
              * torch.ones((num_channels)),
              requires_grad=True,
          )
  
imports: import collections.abc
  from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_poolformer import PoolFormerConfig
label_desc: Use image node_id 1 to create a new PoolFormerLayer object from inherited base classes: nn with example: obj = PoolFormerLayer(config, num_channels, pool_size, hidden_size, intermediate_size, drop_path)