def transform_inputs(images, targets, device):
  """Prepares data to pass forward the model
  during training 
  Keyword arguments:
  - images from batch
  - targets from batch
  - GPU device (e.g. "cuda:2")     
  """
  images = list(image.to(device) for image in images)
  targets = [{k: v.to(device) for k, v in t.items() } for t in targets]
  return images, targets