I'm trying to train an LSTM model in Keras, and am coming up with above error. The following reproduces the error:
from keras.layers import LSTM
from keras.models import Sequential
model = Sequential()
model.add(LSTM(128, input_shape=(1000,1000)))
I'm using Python 3.4, Keras 2.0.4 with TensorFlow backend, version 0.12.1
Here's the traceback:
File "test.py", line 6, in <module>
model.add(LSTM(128, input_shape=(1000,1000)))
File "/usr/local/lib/python3.4/dist-packages/keras/models.py", line 433, in add
layer(x)
File "/usr/local/lib/python3.4/dist-packages/keras/layers/recurrent.py", line 243, in __call__
return super(Recurrent, self).__call__(inputs, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/topology.py", line 558, in __call__
self.build(input_shapes[0])
File "/usr/local/lib/python3.4/dist-packages/keras/layers/recurrent.py", line 1012, in build
constraint=self.bias_constraint)
File "/usr/local/lib/python3.4/dist-packages/keras/legacy/interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/topology.py", line 391, in add_weight
weight = K.variable(initializer(shape), dtype=dtype, name=name)
File "/usr/local/lib/python3.4/dist-packages/keras/layers/recurrent.py", line 1004, in bias_initializer
self.bias_initializer((self.units * 2,), *args, **kwargs),
File "/usr/local/lib/python3.4/dist-packages/keras/backend/tensorflow_backend.py", line 1681, in concatenate
return tf.concat([to_dense(x) for x in tensors], axis)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/array_ops.py", line 1075, in concat
dtype=dtypes.int32).get_shape(
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 669, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/constant_op.py", line 165, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
I've seen a few people report the same issue, e.g. Tensorflow Slim: TypeError: Expected int32, got list containing Tensors of type '_Message' instead. It seems there to be a problem with the concat function needing to be switched around, but here it is already in the right form.
Any idea what the cause of this is?