Getting Generic Out of Memory Error, after 15 epcohs, Seems like Some variable is accumulating over time, and then I am getting this error. My Program was working fine in earlier version of Pytorch I Upgraded to version 0.4.0, Where the volatile key word is deprecated.
So I made following changes to my Code:
def trans_func(x):
    with torch.no_grad():
        return (Variable(x.unsqueeze(0)))

which is being used here:
        transform_train = transforms.Compose([
                transforms.ToTensor(),
                transforms.Lambda(lambda x: F.pad(trans_func(x),(4,4,4,4),mode='reflect').data.squeeze()),

which was earlier:
        transform_train = transforms.Compose([
                transforms.ToTensor(),
                transforms.Lambda(lambda x: F.pad(Variable(x.unsqueeze(0), require_grad=False, volatile=True),(4,4,4,4),mode='reflect').data.squeeze()),

But Now I am getting CUDA_MEMORY_ERROR after 15 epcohs. I am deleting all temp variable after each epoch and doing torch.empty.cache too, but to no avail. Am i missing something over here.
Thanks!