Hi prtblck,
Thanks for the reply. I have used it as you have suggested
The output of grid_sample however is not as expected. I am attaching the files input image, grid and output.
Output is being replicated four times after i apply grid sample as visible in the image   
Order of images: Input image(left), grid(right), output(bottom).
May I know where would it go wrong?