Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for /=: 'Tensor' and 'Tensor' #7

Open
urjan opened this issue May 3, 2016 · 7 comments
Open

Comments

@urjan
Copy link

urjan commented May 3, 2016

I get this error message when I try to run train.py:

Traceback (most recent call last): File "train.py", line 15, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 11, in run sys.exit(main(sys.argv)) File "train.py", line 12, in main train() File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train model = create_model(sess, forward_only=False) File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 27, in create_model forward_only=forward_only) File "/home/urja/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 149, in __init__ softmax_loss_function=softmax_loss_function) File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 651, in model_with_buckets File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 457, in sequence_loss File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 424, in sequence_loss_by_example TypeError: unsupported operand type(s) for /=: 'Tensor' and 'Tensor'

@guduxingzou
Copy link

I have the same problem,someone can help me ???

@guduxingzou
Copy link

@urjan Do you solve this problem?

@urjan
Copy link
Author

urjan commented May 24, 2016

Hi,
Upgrading the tensor flow version from 5 to 6 solved it.
On May 24, 2016 8:17 AM, "guduxingzou" [email protected] wrote:

@urjan https://github.com/urjan Do you solve this problem?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#7 (comment)

@guduxingzou
Copy link

@urjan thanks very much !

@urjan
Copy link
Author

urjan commented May 24, 2016

So, do you have your training script running?
On May 24, 2016 5:14 PM, "guduxingzou" [email protected] wrote:

@urjan https://github.com/urjan thanks very much !


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#7 (comment)

@guduxingzou
Copy link

@urjan no! I find new problem!
如下:
Created model with fresh parameters.
Traceback (most recent call last):
File "train.py", line 15, in
tf.app.run()
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "train.py", line 12, in main
train()
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train
model = create_model(sess, forward_only=False)
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 35, in create_model
session.run(tf.initialize_all_variables())
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 368, in run
results = self._do_run(target_list, unique_fetch_targets, feed_dict_string)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 444, in _do_run
e.code)
tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias': Could not satisfy explicit device specification '/gpu:3'
[[Node: embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias = Variablecontainer="", dtype=DT_FLOAT, shape=[2048], shared_name="", _device="/gpu:3"]]
Caused by op u'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias', defined at:
File "train.py", line 15, in
tf.app.run()
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "train.py", line 12, in main
train()
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/train.py", line 28, in train
model = create_model(sess, forward_only=False)
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model_utils.py", line 27, in create_model
forward_only=forward_only)
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 149, in init
softmax_loss_function=softmax_loss_function)
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 630, in model_with_buckets
bucket_decoder_inputs) #nick pay attention here -- you added bucket_states
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 148, in
lambda x, y: seq2seq_f(x, y, False),
File "/home/yuzp/pythonproject/tensflow/tf_seq2seq_chatbot/tf_seq2seq_chatbot/lib/seq2seq_model.py", line 112, in seq2seq_f
feed_previous=do_decode)
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 341, in embedding_attention_seq2seq
temperature_decode = temperature_decode, temperature = temperature)
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 259, in embedding_attention_decoder
temperature = temperature)
File "build/bdist.linux-x86_64/egg/rnn_enhancement/seq2seq_enhanced.py", line 159, in attention_decoder
cell_output, new_state = cell(x, hidden_state_input) #nick, changed this to your hidden state input
File "build/bdist.linux-x86_64/egg/rnn_enhancement/rnn_cell_enhanced.py", line 1149, in call
cur_inp, new_state = cell(cur_inp, cur_state) #this replaces cur_inp to a differen input
File "build/bdist.linux-x86_64/egg/rnn_enhancement/rnn_cell_enhanced.py", line 520, in call
c = tf.tanh(linear.linear([inputs, r * state], self._num_units, True))
File "build/bdist.linux-x86_64/egg/rnn_enhancement/linear_enhanced.py", line 68, in linear
initializer=tf.constant_initializer(bias_start))
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 242, in get_variable
trainable, collections)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 175, in get_variable
self.reuse, trainable, collections)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 119, in get_variable
collections=collections)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 210, in init
name=name)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 116, in variable_op
container=container, shared_name=shared_name)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 334, in _variable
name=name)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/op_def_library.py", line 664, in apply_op
op_def=op_def)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1834, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/yuzp/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1043, in init
self._traceback = _extract_stack()

@guduxingzou
Copy link

@urjan tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/MultiRNNCell/Cell3/GRUCell/Candidate/Linear/Bias': Could not satisfy explicit device specification '/gpu:3'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants