class_docstr: A `LightAdapterBlock` is a helper model that contains multiple `LightAdapterResnetBlocks`. It is used in the
  `LightAdapter` model.
  
  Parameters:
      in_channels (`int`):
          Number of channels of LightAdapterBlock's input.
      out_channels (`int`):
          Number of channels of LightAdapterBlock's output.
      num_res_blocks (`int`):
          Number of LightAdapterResnetBlocks in the LightAdapterBlock.
      down (`bool`, *optional*, defaults to `False`):
          Whether to perform downsampling on LightAdapterBlock's input.
class_docstr_tok: ["A","`","LightAdapterBlock","`","is","a","helper","model","that","contains","multiple","`","LightAdapterResnetBlocks","`",".","It","is","used","in","the","`","LightAdapter","`","model",".","Parameters",":","in_channels","(","`","int","`",")",":","Number","of","channels","of","LightAdapterBlock","'s","input",".","out_channels","(","`","int","`",")",":","Number","of","channels","of","LightAdapterBlock","'s","output",".","num_res_blocks","(","`","int","`",")",":","Number","of","LightAdapterResnetBlocks","in","the","LightAdapterBlock",".","down","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","perform","downsampling","on","LightAdapterBlock","'s","input","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      num_res_blocks: int,
      down: bool = False,
  ):
      super().__init__()
      mid_channels = out_channels // 4
  
      self.downsample = None
      if down:
          self.downsample = nn.AvgPool2d(
              kernel_size=2, stride=2, ceil_mode=True
          )
  
      self.in_conv = nn.Conv2d(in_channels, mid_channels, kernel_size=1)
      self.resnets = nn.Sequential(
          *[
              LightAdapterResnetBlock(mid_channels)
              for _ in range(num_res_blocks)
          ]
      )
      self.out_conv = nn.Conv2d(
          mid_channels, out_channels, kernel_size=1
      )
  
imports: import os
  from typing import Callable, List, Optional, Union
  import torch
  import torch.nn
  from ..configuration_utils import ConfigMixin, register_to_config
  from ..utils import logging
  from .modeling_utils import ModelMixin
label_desc: Use image node_id 1 to create a new LightAdapterBlock object from inherited base classes: nn with example: obj = LightAdapterBlock(in_channels, out_channels, num_res_blocks, down)