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

lstm-for-epf TypeError : Tensors in list passed to 'values' of 'Concat' Op have types [float64, float32] that don't all match #2

Open
ad34 opened this issue Oct 22, 2016 · 8 comments

Comments

@ad34
Copy link

ad34 commented Oct 22, 2016

Hi,

I m trying to run the script lstm-for-epf.py with tensorflow 0.10

the execution abort due to the following error

File ".../tensorflow/TensorFlow-Tutorials-for-Time-Series-master/lstm_predictor.py", line 117, in lstm_model
output, layers = tf.nn.rnn(stacked_lstm, x
, dtype=dtypes.float32)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/rnn.py", line 219, in rnn
(output, state) = call_cell()
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/rnn.py", line 206, in
call_cell = lambda: cell(input_, state)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/rnn_cell.py", line 812, in call
cur_inp, new_state = cell(cur_inp, cur_state)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/rnn_cell.py", line 310, in call
concat = _linear([inputs, h], 4 * self._num_units, True)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/rnn_cell.py", line 906, in _linear
res = math_ops.matmul(array_ops.concat(1, args), matrix)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/array_ops.py", line 697, in concat
name=name)
File "/Library/Python/2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 414, in _concat
values=values, name=name)
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 437, in apply_op
raise TypeError("%s that don't all match." % prefix)
TypeError: Tensors in list passed to 'values' of 'Concat' Op have types [float64, float32] that don't all match.

there is a float64/32 conversion issue.

adding this in _lstm_model fix the issue.

X = tf.cast(X,tf.float32)

there is probably another better fix, I just started playing with the code :)

@arnoutaertgeerts
Copy link

I think this is a good solution. TensorFlow works best with the float32 type but the np.sin function creates a float64 type array. This causes an error in TensorFlow >0.9.

@ad34
Copy link
Author

ad34 commented Nov 16, 2016

@arnoutaertgeerts after making the change I still have errors. as the project dont seems to be active anymore I will probably try to port it to tensorflow >0.9 on my side.

@tgjeon
Copy link
Owner

tgjeon commented Nov 22, 2016

Thanks for the interesting on this github.
Now, I'm working on changing this repository into Keras.

@ad34
Copy link
Author

ad34 commented Nov 22, 2016

@tgjeon nice !

@ghost
Copy link

ghost commented Feb 4, 2017

Hello - was this issue ever fixed? I have the same problem :/ I would like to use this code.

@fayazahasan
Copy link

@ashleymaeconard I am working on time series predictions, facing similar issues as yours. Did you find a solution??

@0b01
Copy link

0b01 commented Jun 17, 2017

@ashleymaeconard @fayazahasan

The original poster added the fix in his post.

Add this line...

X = tf.cast(X,tf.float32)

to...

@0b01
Copy link

0b01 commented Jun 17, 2017

I encountered this error from using google/seq2seq. This answer also applies.

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

5 participants