This will work regardless of whether you are using PyTorch or Tensorflow.