code: def instantiate_upsample_block(
      block: Union[str, Type[AbstractResizeLayer]],
      in_channels,
      scale_factor: int,
      **kwargs,
  ) -> AbstractResizeLayer:
      if isinstance(block, str):
          block = UpsampleLayerType(block)
  
      if isinstance(block, UpsampleLayerType):
          block = {
              UpsampleLayerType.NEAREST: NearestNeighborResizeLayer,
              UpsampleLayerType.BILINEAR: BilinearInterpolationLayer,
              UpsampleLayerType.PIXEL_SHUFFLE: PixelShuffle,
              UpsampleLayerType.PIXEL_SHUFFLE_LINEAR: PixelShuffleWithLinear,
              UpsampleLayerType.DECONVOLUTION: DeconvolutionUpsample2d,
              UpsampleLayerType.RESIDUAL_DECONV: ResidualDeconvolutionUpsample2d,
          }[block]
  
      return block(in_channels, scale_factor=scale_factor, **kwargs)
  
imports: from enum import Enum
  from math import hypot
  from typing import Optional, List, Tuple, Union, Type
  import torch
  from torch import nn, Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: instantiate_upsample_block(block, in_channels, scale_factor) and returns: block