class_docstr: A 2D FIR downsampling layer with an optional convolution.
  
  Parameters:
      channels (`int`):
          number of channels in the inputs and outputs.
      use_conv (`bool`, default `False`):
          option to use a convolution.
      out_channels (`int`, optional):
          number of output channels. Defaults to `channels`.
      fir_kernel (`tuple`, default `(1, 3, 3, 1)`):
          kernel for the FIR filter.
class_docstr_tok: ["A","2D","FIR","downsampling","layer","with","an","optional","convolution",".","Parameters",":","channels","(","`","int","`",")",":","number","of","channels","in","the","inputs","and","outputs",".","use_conv","(","`","bool","`",",","default","`","False","`",")",":","option","to","use","a","convolution",".","out_channels","(","`","int","`",",","optional",")",":","number","of","output","channels",".","Defaults","to","`","channels","`",".","fir_kernel","(","`","tuple","`",",","default","`","(","1",",","3",",","3",",","1",")","`",")",":","kernel","for","the","FIR","filter","."]
code: def __init__(
      self,
      channels: int = None,
      out_channels: Optional[int] = None,
      use_conv: bool = False,
      fir_kernel: Tuple[int, int, int, int] = (1, 3, 3, 1),
  ):
      super().__init__()
      out_channels = out_channels if out_channels else channels
      if use_conv:
          self.Conv2d_0 = nn.Conv2d(
              channels, out_channels, kernel_size=3, stride=1, padding=1
          )
      self.fir_kernel = fir_kernel
      self.use_conv = use_conv
      self.out_channels = out_channels
  
imports: from functools import partial
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from ..utils import USE_PEFT_BACKEND
  from .activations import get_activation
  from .attention import AdaGroupNorm
  from .attention_processor import SpatialNorm
  from .lora import LoRACompatibleConv, LoRACompatibleLinear
label_desc: Use image node_id 1 to create a new FirDownsample2D object from inherited base classes: nn with example: obj = FirDownsample2D(channels, out_channels, use_conv, fir_kernel)