code: def default_upsampler(
      spatial_size: Sized, align_corners: bool = False
  ) -> Callable[[torch.Tensor], torch.Tensor]:
      """
      A linear interpolation method for upsampling the feature map.
      The output of this function is a callable `func`,
      such that `func(x)` returns an upsampled tensor.
      """
  
      def up(x):
          linear_mode = [
              InterpolateMode.LINEAR,
              InterpolateMode.BILINEAR,
              InterpolateMode.TRILINEAR,
          ]
          interp_mode = linear_mode[len(spatial_size) - 1]
          return F.interpolate(
              x,
              size=spatial_size,
              mode=str(interp_mode.value),
              align_corners=align_corners,
          )
  
      return up
  
imports: from __future__ import annotations
  from collections.abc import Callable, Sized
  import torch
  import torch.nn.functional
  from monai.utils import InterpolateMode
label_desc: Use image node_id 1 for calling a global function with example usage: default_upsampler(spatial_size, align_corners) and returns: up, F