abhishekkrthakur / is_that_a_duplicate_quora_question

441 stars 178 forks source link

Shows error on tensorflow backend #3

Closed nafizh closed 7 years ago

nafizh commented 7 years ago

I am running the deepnet.py file but the following error is coming up-

Build model...

TypeError Traceback (most recent call last)

in () 80 model5 = Sequential() 81 model5.add(Embedding(len(word_index) + 1, 300, input_length=40, dropout=0.2)) ---> 82 model5.add(LSTM(300, dropout=0.2, recurrent_dropout=0.2)) 83 84 model6 = Sequential() /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/models.pyc in add(self, layer) 453 output_shapes=[self.outputs[0]._keras_shape]) 454 else: --> 455 output_tensor = layer(self.outputs[0]) 456 if isinstance(output_tensor, list): 457 raise TypeError('All layers in a Sequential model ' /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in __call__(self, inputs, initial_state, **kwargs) 250 else: 251 kwargs['initial_state'] = initial_state --> 252 return super(Recurrent, self).__call__(inputs, **kwargs) 253 254 def call(self, inputs, mask=None, initial_state=None, training=None): /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/topology.pyc in __call__(self, inputs, **kwargs) 552 553 # Actually call the layer, collecting output(s), mask(s), and shape(s). --> 554 output = self.call(inputs, **kwargs) 555 output_mask = self.compute_mask(inputs, previous_mask) 556 /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in call(self, inputs, mask, initial_state, training) 288 'or `batch_shape` argument to your Input layer.') 289 constants = self.get_constants(inputs, training=None) --> 290 preprocessed_input = self.preprocess_input(inputs, training=None) 291 last_output, outputs, states = K.rnn(self.step, 292 preprocessed_input, /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in preprocess_input(self, inputs, training) 1031 self.dropout, input_dim, self.units, 1032 timesteps, training=training) -> 1033 return K.concatenate([x_i, x_f, x_c, x_o], axis=2) 1034 else: 1035 return inputs /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.pyc in concatenate(tensors, axis) 1525 return tf.sparse_concat(axis, tensors) 1526 else: -> 1527 return tf.concat([to_dense(x) for x in tensors], axis) 1528 1529 /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.pyc in concat(concat_dim, values, name) 1073 ops.convert_to_tensor(concat_dim, 1074 name="concat_dim", -> 1075 dtype=dtypes.int32).get_shape( 1076 ).assert_is_compatible_with(tensor_shape.scalar()) 1077 return identity(values[0], name=scope) /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype) 667 668 if ret is None: --> 669 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) 670 671 if ret is NotImplemented: /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.pyc in _constant_tensor_conversion_function(v, dtype, name, as_ref) 174 as_ref=False): 175 _ = as_ref --> 176 return constant(v, dtype=dtype, name=name) 177 178 /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.pyc in constant(value, dtype, shape, name, verify_shape) 163 tensor_value = attr_value_pb2.AttrValue() 164 tensor_value.tensor.CopyFrom( --> 165 tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) 166 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype) 167 const_tensor = g.create_op( /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.pyc in make_tensor_proto(values, dtype, shape, verify_shape) 365 nparray = np.empty(shape, dtype=np_dt) 366 else: --> 367 _AssertCompatible(values, dtype) 368 nparray = np.array(values, dtype=np_dt) 369 # check to them. /home/nafizh/anaconda3/envs/py2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.pyc in _AssertCompatible(values, dtype) 300 else: 301 raise TypeError("Expected %s, got %s of type '%s' instead." % --> 302 (dtype.name, repr(mismatch), type(mismatch).__name__)) 303 304 TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

I am using keras 2.0.1 on tensorflow-gpu 0.12.1.

nafizh commented 7 years ago

Aah, the issue got solved after upgrading tensorflow-gpu to 1.0.1