TensorFlow-Tutorials-for-Time-Series
TensorFlow-Tutorials-for-Time-Series copied to clipboard
lstm-for-epf TypeError : Tensors in list passed to 'values' of 'Concat' Op have types [float64, float32] that don't all match
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
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 :)
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.
@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.
Thanks for the interesting on this github. Now, I'm working on changing this repository into Keras.
@tgjeon nice !
Hello - was this issue ever fixed? I have the same problem :/ I would like to use this code.
@ashleymaeconard I am working on time series predictions, facing similar issues as yours. Did you find a solution??
@ashleymaeconard @fayazahasan
The original poster added the fix in his post.
Add this line...
X = tf.cast(X,tf.float32)
to... https://github.com/tgjeon/TensorFlow-Tutorials-for-Time-Series/blob/4672e506a8a0364c4b58d591e5d9486ce0e0269c/lstm_predictor.py#L114
I encountered this error from using google/seq2seq. This answer also applies.