Cuda out of memory. Memory leaks on pytorch

I am very new to PyTorch. I have been working on UNET segmentation on retinal fundus images(RGB) + masks(Grayscale) for hemorrhage segmentation. I am trying to train on GPU + High-RAM on google colab pro. I am constantly running into ‘RunTimeError: Cuda out of memory’. I tried torch.cuda.empty_cache() for each X,y training loop. I also tried gc.collect() for X,y,y_pred after computing loss each time. I am still not able to figure out why the almost 13GB of GPU is getting used for just first epoch.
Here is the complete notebook: UNET_train
Any help would be great.

I think I figured it out. The images and masks are not resized properly leading to out of memory issues.