class_docstr: A 2D FIR upsampling 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","upsampling","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 forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
      if self.use_conv:
          height = self._upsample_2d(
              hidden_states,
              self.Conv2d_0.weight,
              kernel=self.fir_kernel,
          )
          height = height + self.Conv2d_0.bias.reshape(1, -1, 1, 1)
      else:
          height = self._upsample_2d(
              hidden_states, kernel=self.fir_kernel, factor=2
          )
  
      return height
  
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 3 for calling the FirUpsample2D obj's underlying member method code with example usage: obj.forward(hidden_states) and returns: height