Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Rexbalaeniceps opened this issue Dec 28, 2021 · 1 comment

Comments

@Rexbalaeniceps
Copy link

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
@Rexbalaeniceps Rexbalaeniceps changed the title ValueError: Shapes (4, 50, 300) and () are incompatible TypeError: Expected int32, got <tf.Variable 'lstm_1_W_i:0' shape=(50, 300) dtype=float32_ref> of type 'Variable' instead. Dec 28, 2021
@Struggle-lsl
Copy link

我也是这样,你解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants