class_docstr: A 2D K-upsampling layer.
  
  Parameters:
      pad_mode (`str`, *optional*, default to `"reflect"`): the padding mode to use.
class_docstr_tok: ["A","2D","K-upsampling","layer",".","Parameters",":","pad_mode","(","`","str","`",",","*","optional","*",",","default","to","`","``","reflect","''","`",")",":","the","padding","mode","to","use","."]
code: def forward(self, inputs: torch.Tensor) -> torch.Tensor:
      inputs = F.pad(inputs, ((self.pad + 1) // 2,) * 4, self.pad_mode)
      weight = inputs.new_zeros(
          [
              inputs.shape[1],
              inputs.shape[1],
              self.kernel.shape[0],
              self.kernel.shape[1],
          ]
      )
      indices = torch.arange(inputs.shape[1], device=inputs.device)
      kernel = self.kernel.to(weight)[None, :].expand(
          inputs.shape[1], -1, -1
      )
      weight[indices, indices] = kernel
      return F.conv_transpose2d(
          inputs, weight, stride=2, padding=self.pad * 2 + 1
      )
  
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 2 for calling the KUpsample2D obj's underlying member method code with example usage: obj.forward(inputs) and returns: F