alexander-rakhlin/CNN-for-Sentence-Classification-in-Keras

Merge stopped working after keras update

rodrigocesar opened this issue · 0 comments

The code was working just fine before I updated the keras version to 2.0.

After the update, I am having errors with the Merge function.

The error log is the following:

rodrigo@garage:~/Projetos/CNN-for-Sentence-Classification-in-Keras$ python3 trainGraph_modelo_velho.py
Using TensorFlow backend.
/usr/local/lib/python3.5/dist-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection
module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. T
his module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Model variation is CNN-non-static
Loading data...
Parsing sentences from training set
/usr/local/lib/python3.5/dist-packages/gensim/models/phrases.py:274: UserWarning: For a faster implementation, use the gensim.models.phrases.Phraser class
warnings.warn("For a faster implementation, use the gensim.models.phrases.Phraser class")
(13575, 10)
(13575, 194)
Loading existing Word2Vec model '100features_10minwords_10context'
Vocabulary Size: 12962
Sequence Max Length: 194
Tensor("flatten_1/Reshape:0", shape=(?, ?), dtype=float32)
<class 'list'>
trainGraph_modelo_velho.py:160: UserWarning: The Merge layer is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. a dd, concatenate, etc.
out = Merge(mode='concat')(convs)
Traceback (most recent call last):
File "trainGraph_modelo_velho.py", line 160, in
out = Merge(mode='concat')(convs)
File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 554, in call
output = self.call(inputs, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/keras/legacy/layers.py", line 210, in call
return K.concatenate(inputs, axis=self.concat_axis)
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 1553, in concatenate
return tf.concat([to_dense(x) for x in tensors], axis)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/array_ops.py", line 1075, in concat
dtype=dtypes.int32).get_shape(
File "/usr/local/lib/python3.5/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.5/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.5/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.5/dist-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python3.5/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.