Skip to content

TypeError: Expected int32, got <tf.Variable 'lstm_1_W_i:0' shape=(50, 300) dtype=float32_ref> of type 'Variable' instead. #18

@Rexbalaeniceps

Description

@Rexbalaeniceps

hello ~ I got a problem as the following

�[94m[INFO]�[0m (nea.models) Building a REGRESSION model with POOLING
Traceback (most recent call last):
  File "train_nea.py", line 160, in <module>
    model = create_model(args, train_y.mean(axis=0), overal_maxlen, vocab)
  File "/data1/wbxu/AES/nea-master/nea/models.py", line 63, in create_model
    model.add(RNN(args.rnn_dim, return_sequences=True, dropout_W=dropout_W, dropout_U=dropout_U))
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/keras/models.py", line 308, in add
    output_tensor = layer(self.outputs[0])
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/keras/engine/topology.py", line 487, in __call__
    self.build(input_shapes[0])
  File "/home/wbxu/anaconda3/envs/nea-master/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/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 716, in concatenate
    return tf.concat(axis, [to_dense(x) for x in tensors])
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1043, in concat
    dtype=dtypes.int32).get_shape(
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 676, in convert_to_tensor
    as_ref=False)
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 741, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 374, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "/home/wbxu/anaconda3/envs/nea-master/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
    (dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got <tf.Variable 'lstm_1_W_i:0' shape=(50, 300) dtype=float32_ref> of type 'Variable' instead.

my env is

keras 1.1.0
tensorflow 1.6.0
teano 0.8.2
nltk 3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions