iamhankai / attribute-aware-attention

[ACM MM 2018] Attribute-Aware Attention Model for Fine-grained Representation Learning
https://arxiv.org/abs/1901.00392
156 stars 30 forks source link

ValueError: Shape must be rank 2 but is rank 3 for 'MatMul_29' (op: 'MatMul') with input shapes: [?,196,512], [?,512]. #14

Closed xxchenxx closed 5 years ago

xxchenxx commented 5 years ago

Hi @iamhankai. When I ran your code I got the following error:

File "/home/t0c01zx/anaconda3/envs/keras/lib/python3.6/site-packages/keras/engine/topology.py", line 1409, in call output = K.batch_dot(l1, l2, self.dot_axes) File "/home/t0c01zx/anaconda3/envs/keras/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 884, in batch_dot out = tf.matmul(x, y, adjoint_a=adj_x, adjoint_b=adj_y) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2455, in matmul a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5333, in mat_mul name=name) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op op_def=op_def) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1823, in init control_input_ops) File "/home/t0c01zx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1662, in _create_c_op raise ValueError(str(e)) ValueError: Shape must be rank 2 but is rank 3 for 'MatMul_29' (op: 'MatMul') with input shapes: [?,196,512], [?,512].

I was using Keras 1.2.1 and Tensorflow 1.13.0. The model I choose is ResNet50.

Looking forward to your reply!

iamhankai commented 5 years ago

refer to #13

MuruganR96 commented 4 years ago

Hi @Ch4nYH , Have you resolved this issue?

I am also facing the same issue. Please help me to solve this issue @Ch4nYH @iamhankai @muneeb699