code: def gen_train_data():
      """
      Generate aligned training data to train a patch similarity function.
      Given some original images, generate lots of encoded versions.
      """
      global encoded_train, original_train
  
      encoded_train = []
      original_train = []
  
      args = Xray(True)
  
      C = 100
      for i in range(30):
          print(i)
          torch.manual_seed(int(time.time()))
          e = PrivateEncoder(args).cuda()
          batch = np.random.randint(0, len(x_train), size=C)
          xin = x_train[batch]
  
          r = []
          for i in range(0, C, 32):
              r.extend(
                  e(torch.tensor(xin[i : i + 32]).cuda())
                  .detach()
                  .cpu()
                  .numpy()
              )
          r = np.array(r)
  
          encoded_train.append(r)
          original_train.append(xin)
  
imports: import collections
  import hashlib
  import time
  import multiprocessing
  import torch
  import numpy
  import torch.nn
  import scipy.stats
  import matplotlib.pyplot
  from PIL import Image
  import jax
  import jax.numpy
  import objax
  import scipy.optimize
  import numpy
  import multiprocessing
label_desc: Use image node_id 2 for calling a global function with example usage: gen_train_data() without return types