BUPTLdy / Sentiment-Analysis

Chinese Shopping Reviews sentiment analysis
http://buptldy.github.io/2016/07/20/2016-07-20-sentiment%20analysis/
351 stars 168 forks source link

ValueError: Shapes (4, 100, 50) and () are incompatible源程序报错 #22

Open yezhaoguli opened 3 years ago

yezhaoguli commented 3 years ago

Traceback (most recent call last): File "Sentiment_lstm.py", line 204, in lstm_predict(string) File "Sentiment_lstm.py", line 178, in lstm_predict model = model_from_yaml(yaml_string) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/models.py", line 187, in model_from_yaml return layer_from_config(config, custom_objects=custom_objects) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 36, in layer_from_config return layer_class.from_config(config['config']) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/models.py", line 1036, in from_config model.add(layer) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/models.py", line 312, in add output_tensor = layer(self.outputs[0]) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/engine/topology.py", line 487, in call self.build(input_shapes[0]) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/layers/recurrent.py", line 710, in build self.W = K.concatenate([self.W_i, self.W_f, self.W_c, self.W_o]) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 718, in concatenate return tf.concat(axis, [to_dense(x) for x in tensors]) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper return target(*args, **kwargs) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1254, in concat tensor_shape.scalar()) File "/home/user/anaconda3/envs/gu_py27/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 1023, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (4, 100, 50) and () are incompatible