carpedm20 / NTM-tensorflow

"Neural Turing Machine" in Tensorflow
MIT License
1.05k stars 214 forks source link

Python3? #31

Open machuck opened 7 years ago

machuck commented 7 years ago

According to the readme, it supports both python 2 and 3. But using python3 to run the first example (train) in the readme cause an error about xrange/range. So the question is how does it support python3? Using 2to3 is tested to be okay? TIA!

benjisympa commented 6 years ago

Hi, I try the code with Python 3, I've also changed the xrange to range but I have this problem :

Percent: [####################] 100.00% Finished. [] Build a NTM model finished [] Reading checkpoints... Traceback (most recent call last): File "/Users/maurice/PycharmProjects/NTM/NTM-tensorflow/main.py", line 72, in tf.app.run() File "/Users/maurice/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/Users/maurice/PycharmProjects/NTM/NTM-tensorflow/main.py", line 62, in main task.run(ntm, int(FLAGS.test_max_length * 1 / 3), sess) File "/Users/maurice/PycharmProjects/NTM/NTM-tensorflow/tasks/copy.py", line 30, in run output_states = [state['read_w'][0] for state in ntm.get_output_states(seq_length)] File "/Users/maurice/PycharmProjects/NTM/NTM-tensorflow/ntm.py", line 214, in get_output_states if not self.output_states.has_key(seq_length): AttributeError: 'collections.defaultdict' object has no attribute 'has_key'

Can you help me pls ?

Thanks a lot