Runtime Error: cuDNN error: CUDNN_STATUS_BAD_PARAM

While the second epoch of my CycleGAN model was running I ran into this error
RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM

and the error pointed to this function

def pass_through_discriminator(discriminator, image):
    score, k = 0, Variable(torch.zeros(1)).type(dtype)
    xp, yp = 0, 0
    x, y = 70, 70
    offset = 25
    while x < 128:
        while y < 128:
            k += 1
            score += discriminator(image[:, :, xp:x, yp:y])
            yp += offset
            y += offset
        xp += offset
        x += offset
    return score / k

I read in other topics that the size of the image has to be increased, but am not very clear.
Any suggestions on how to solve this
Thanks in advance !

Could you post a code snippet to reproduce this error, please?