pumpikano / tf-dann

Domain-Adversarial Neural Network in Tensorflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

batch_generator doesn't have next()

youngzokim opened this issue · comments

Hello,

I am running DANN but there's a problem like this:
AttributeError: 'generator' object has no attribute 'next'
(more specifically, batch_generator in util.py)

If I am doing something wrong, let me know :)

It sounds like you might be using Python 3.0. I have only tested this repo with 2.7. I think it should be relatively easy to make it run in 3.0, but I'm not sure.

I should also note that this repo was written with TF 0.9 and I haven't gotten around to updating it for newer versions, so think may not work as expected... hopefully I'll have time soon.

Thanks for quick reply!
Yes. As you said, TF got some updates and I had to modify a little bit on your codes as some of the attributes and things changed. I wasn't aware that this kind of issue could happen because of Python 3.5 (I'm using). Currently I am adding a couple of lines to get the next() work.

I also have the same problem with @youngzokim . I tried to fix this by changing from S_batches.next() to next(S_batches) or S_batches.next() based on this link but this did not work. Could you please let me know if you fix this problem??

Changing from S_batches.next() to next(S_batches) DID WORK, but the problem was not the only one. It seems like there are some internal problems with the latest TensorFlow version for Win 10. After amending the "next()" error, you will find another error related with this link. The last answer rings the bell for my case. I am trying not to use "one-hot-function" in this DANN implementation. I will report here if I fix this issue by doing this.

I succeeded to run the code in Python3 but encountered the other issue. I have opened another issue here.

A.next() only works in Python 2.x.
For Python 3.x, use A.__next__().
That's all.

For Python 3.x, next(A) is more canonical.

I updated everything for Python 3 compatibility - please let me know if there are still problems.