caogang / wgan-gp

A pytorch implementation of Paper "Improved Training of Wasserstein GANs"
MIT License
1.51k stars 345 forks source link

AttributeError: 'generator' object has no attribute 'next' #44

Open morawi opened 5 years ago

morawi commented 5 years ago

Hi, thanks for sharing the code. Not sure what is the source of error, I am using Python 3.6 and PyTorch 0.4.

The line where the error occurred is _data = gen.next(), in the file gan_cifar10.py

# (1) Update D network
    ###########################
    for p in netD.parameters():  # reset requires_grad
        p.requires_grad = True  # they are set to False below in netG update
    for i in range(CRITIC_ITERS):
        _data = gen.next()
        netD.zero_grad()
PaTricksStar commented 5 years ago

for python3, use _next_() instead.

RohitKeshari commented 3 years ago

use this

gen.__next__()