Adversarial-Autoencoder icon indicating copy to clipboard operation
Adversarial-Autoencoder copied to clipboard

Error in utils.inf_train_gen()

Open mfaraki opened this issue 5 years ago • 1 comments

I tried to run the code for mnist. Something goes wrong with loading the images in the function:

def inf_train_gen(train_gen): while True: for i, (images, _) in enumerate(train_gen): # yield images.astype('float32').reshape(BATCH_SIZE, 3, 32, 32).transpose(0, 2, 3, 1) yield images

File "Adversarial-Autoencoder/utils.py", line 68, in inf_train_gen for i, (images, _) in enumerate(train_gen): TypeError: 'function' object is not iterable

mfaraki avatar Mar 22 '19 05:03 mfaraki

Hi, thanks for pointing this out. I'm not sure how that error crept in there. data/mnist.py was returning a function get_epoch -- which returns a generator. The inf_gen was missing the function call train_gen() in the enumeration, among one or two other issues. I pushed a working version.

Really, the whole thing needs to be refactored to PyTorch 1.0+. If you're using anything after 0.31 (I believe), this code has a lot of deprecated functionality. The inf_gen idea is especially archaic and needs to be updated to use PyTorch dataloaders. Ill look at doing it this weekend.

neale avatar Mar 23 '19 06:03 neale