code: def sample_one(canvas_size, mnist):
      i = np.random.randint(mnist["digits"].shape[0])
      digit = mnist["digits"][i]
      label = mnist["labels"][i].item()
      scale = 0.1 * np.random.randn() + 1.3
      new_size = tuple(int(s / scale) for s in digit.shape)
      resized = imresize(digit, new_size)
      w = resized.shape[0]
      assert w == resized.shape[1]
      padding = canvas_size - w
      pad_l = np.random.randint(0, padding)
      pad_r = np.random.randint(0, padding)
      pad_width = ((pad_l, padding - pad_l), (pad_r, padding - pad_r))
      positioned = np.pad(
          resized, pad_width, "constant", constant_values=0
      )
      return positioned, label
  
file_path: pyro/pyro/contrib/examples/multi_mnist.py
imports: import os
  import numpy
  from PIL import Image
  from pyro.contrib.examples.util import get_data_loader
label_desc: Use image node_id 2 for calling a global function with example usage: sample_one(canvas_size, mnist) and returns: positioned,  label