class_docstr: Generate a smooth field array by defining a smaller randomized field and then reinterpolating to the desired size.
  
  This exploits interpolation to create a smoothly varying field used for other applications. An initial randomized
  field is defined with `rand_size` dimensions with `pad` number of values padding it along each dimension using
  `pad_val` as the value. If `spatial_size` is given this is interpolated to that size, otherwise if None the random
  array is produced uninterpolated. The output is always a Pytorch tensor allocated on the specified device.
  
  Args:
      rand_size: size of the randomized field to start from
      pad: number of pixels/voxels along the edges of the field to pad with `pad_val`
      pad_val: value with which to pad field edges
      low: low value for randomized field
      high: high value for randomized field
      channels: number of channels of final output
      spatial_size: final output size of the array, None to produce original uninterpolated field
      mode: interpolation mode for resizing the field
      align_corners: if True align the corners when upsampling field
      device: Pytorch device to define field on
class_docstr_tok: ["Generate","a","smooth","field","array","by","defining","a","smaller","randomized","field","and","then","reinterpolating","to","the","desired","size",".","This","exploits","interpolation","to","create","a","smoothly","varying","field","used","for","other","applications",".","An","initial","randomized","field","is","defined","with","`","rand_size","`","dimensions","with","`","pad","`","number","of","values","padding","it","along","each","dimension","using","`","pad_val","`","as","the","value",".","If","`","spatial_size","`","is","given","this","is","interpolated","to","that","size",",","otherwise","if","None","the","random","array","is","produced","uninterpolated",".","The","output","is","always","a","Pytorch","tensor","allocated","on","the","specified","device",".","Args",":","rand_size",":","size","of","the","randomized","field","to","start","from","pad",":","number","of","pixels\/voxels","along","the","edges","of","the","field","to","pad","with","`","pad_val","`","pad_val",":","value","with","which","to","pad","field","edges","low",":","low","value","for","randomized","field","high",":","high","value","for","randomized","field","channels",":","number","of","channels","of","final","output","spatial_size",":","final","output","size","of","the","array",",","None","to","produce","original","uninterpolated","field","mode",":","interpolation","mode","for","resizing","the","field","align_corners",":","if","True","align","the","corners","when","upsampling","field","device",":","Pytorch","device","to","define","field","on"]
docstr: Set the `spatial_size` and `spatial_zoom` attributes used for interpolating the field to the given
  dimension, or not interpolate at all if None.
  
  Args:
      spatial_size: new size to interpolate to, or None to not interpolate
code: def set_spatial_size(
      self, spatial_size: Sequence[int] | None
  ) -> None:
      """
      Set the `spatial_size` and `spatial_zoom` attributes used for interpolating the field to the given
      dimension, or not interpolate at all if None.
  
      Args:
          spatial_size: new size to interpolate to, or None to not interpolate
      """
      if spatial_size is None:
          self.spatial_size = None
          self.spatial_zoom = None
      else:
          self.spatial_size = tuple(spatial_size)
          self.spatial_zoom = tuple(
              s / f
              for s, f in zip(self.spatial_size, self.total_rand_size)
          )
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from typing import Any
  import numpy
  import torch
  from torch.nn.functional import grid_sample, interpolate
  from monai.config.type_definitions import NdarrayOrTensor
  from monai.data.meta_obj import get_track_meta
  from monai.networks.utils import meshgrid_ij
  from monai.transforms.transform import Randomizable, RandomizableTransform
  from monai.transforms.utils_pytorch_numpy_unification import moveaxis
  from monai.utils import GridSampleMode, GridSamplePadMode, InterpolateMode
  from monai.utils.enums import TransformBackends
  from monai.utils.module import look_up_option
  from monai.utils.type_conversion import convert_to_dst_type, convert_to_tensor
label_desc: Use image node_id 3 for calling the SmoothField obj's underlying member method code with example usage: obj.set_spatial_size(spatial_size) without return types