NTM-tensorflow icon indicating copy to clipboard operation
NTM-tensorflow copied to clipboard

TypeError: softmax_loss_function() got an unexpected keyword argument 'logits'

Open machuck opened this issue 7 years ago • 1 comments

After running 2to3 -w on all the .py files, I got an error using python3.4 running the first example in the readme (train):

[] Building a NTM model Percent: [####################] 100.00% Finished. [] Build a NTM model finished [*] Reading checkpoints... Traceback (most recent call last): File "main.py", line 72, in tf.app.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 62, in main task.run(ntm, int(FLAGS.test_max_length * 1 / 3), sess) File "/home/can/NTM-tensorflow/tasks/copy.py", line 35, in run [ntm.get_loss(seq_length)], File "/home/can/NTM-tensorflow/ntm.py", line 206, in get_loss softmax_loss_function=softmax_loss_function) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1134, in sequence_loss softmax_loss_function=softmax_loss_function)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1089, in sequence_loss_by_example crossent = softmax_loss_function(labels=target, logits=logit) TypeError: softmax_loss_function() got an unexpected keyword argument 'logits'

machuck avatar Jul 14 '17 18:07 machuck

I've got the same error with Tensorflow 1.2.1. But as mentioned in Prerequisites section, it works with Tensorflow 1.1.0

This specific error can be fixed by simply changing softmax_loss_function(labels, inputs) to softmax_loss_function(labels, logits) in ntm.py#L15, but further errors might be raised regarding tensorflow version changes.

fshamshirdar avatar Aug 02 '17 21:08 fshamshirdar