CycleGAN using UNET

I’m trying to implement CycleGAN with UNET as a generator. Initially, using dynamic UNET class I have implemented and the results were awful(literally model was doing nothing) then after fiddling for some time I got to know that as we are feeding model with batchsize = 1, the variance in batchnorm goes to very small value shooting the activations so I choose to change the dynamic_unet and unet_block and tried to swap instance norm with batch norm as instance norm doesn’t deal with batchsize. But while fitting the model I’m getting CUDA out of memory error and I tried to decrease the model size but still facing the same problem.

I dont think so its a normal memory issue, as I said I made my image aswell as model very small I could(even checked the number of parameters). I could run dummy_batch into the model but in the actual fit I’m getting this error. What I did exactly is I copied source code of UNET from fastai and changed it so that it uses instancenorm and ran it in my notebook.

Solved!!! Peace:)