I am trying to train a gan but while training the generator network, during  the backward(), I get the error: RuntimeError: ones needs to be contiguous
Here is the output during debugging:
> <ipython-input-34-c3622f575644>(80)<module>()
-> fake = gen(z, thetas)
(Pdb) n
> <ipython-input-34-c3622f575644>(81)<module>()
-> h5s, h5, cont_vars, _, _, _, _ = disc(fake)
(Pdb) n
> <ipython-input-34-c3622f575644>(82)<module>()
-> aux_loss = latent_lambda * mse(z, cont_vars)
(Pdb) n
> <ipython-input-34-c3622f575644>(85)<module>()
-> gen_loss = ce_loss(h5, torch.ones_like(h5)) + aux_loss
(Pdb) n
> <ipython-input-34-c3622f575644>(86)<module>()
-> gen_loss.backward()
(Pdb) n
RuntimeError: ones needs to be contiguous

Why is this happening and what is the possible solution?