code: def get_grid(batchsize, rows, cols, fp16):
      # Input is a tensor with shape [batchsize, channels, rows, cols]
      # Output is tensor with shape [batchsize, 2, rows, cols]
      # where each col in [:, 1, :, :] and each row in [:, 0, :, :]
      # is an evenly spaced arithmetic progression from -1.0 to 1.0
  
      hor = torch.linspace(-1.0, 1.0, cols)
      hor = hor.view(1, 1, 1, cols)
      hor = hor.expand(batchsize, 1, rows, cols)
      ver = torch.linspace(-1.0, 1.0, rows)
      ver = ver.view(1, 1, rows, 1)
      ver = ver.expand(batchsize, 1, rows, cols)
  
      t_grid = torch.cat([hor, ver], 1)
  
      if fp16:
          return Variable(t_grid.half().cuda())
      else:
          return Variable(t_grid.cuda())
  
file_path: DALI/docs/examples/use_cases/video_superres/model/model.py
imports: import time
  import scipy.misc
  import numpy
  from math import floor, log
  import torch
  import torch.nn
  from torch.nn import init
  from torch.autograd import Variable
  from torch.nn.functional import upsample
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: get_grid(batchsize, rows, cols, fp16) and returns: Variable, Variable