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

Getting error! #3

Open
kbhartiya opened this issue Jan 12, 2019 · 3 comments
Open

Getting error! #3

kbhartiya opened this issue Jan 12, 2019 · 3 comments

Comments

@kbhartiya
Copy link


ValueError Traceback (most recent call last)
in ()
----> 1 model = get_model()

in get_model()
15 num_capsule=Num_capsule,
16 dim_capsule=Dim_capsule,
---> 17 routings=Routings)(x)
18
19 capsule = Flatten()(capsule)

/opt/conda/lib/python3.6/site-packages/Keras-2.2.4-py3.6.egg/keras/engine/base_layer.py in call(self, inputs, **kwargs)
455 # Actually call the layer,
456 # collecting output(s), mask(s), and shape(s).
--> 457 output = self.call(inputs, **kwargs)
458 output_mask = self.compute_mask(inputs, previous_mask)
459

in call(self, u_vecs)
70 if i < self.routings - 1:
71 o = K.l2_normalize(o, -1)
---> 72 b = K.batch_dot(o, u_hat_vecs, [2, 3])
73 if K.backend() == 'theano':
74 b = K.sum(b, axis=1)

/opt/conda/lib/python3.6/site-packages/Keras-2.2.4-py3.6.egg/keras/backend/tensorflow_backend.py in batch_dot(x, y, axes)
1222 str(x_shape) + ' and ' + str(y_shape) +
1223 ' with axes=' + str(axes) + '. x.shape[%d] != '
-> 1224 'y.shape[%d] (%d != %d).' % (axes[0], axes[1], d1, d2))
1225
1226 # backup ndims. Need them later.

ValueError: Can not do batch_dot on inputs with shapes (None, 10, 10, 16) and (None, 10, None, 16) with axes=[2, 3]. x.shape[2] != y.shape[3] (10 != 16).

@stefan-it
Copy link
Owner

@kbhartiya What of version of TensorFlow are you using 🤔 I'm using 1.12rc0 with the latest Keras 2.2.4 version and training starts without problem.

@Rajkumar-Mohan
Copy link

Rajkumar-Mohan commented Mar 4, 2020

@stefan-it I am using keras 2.3.1 and tensorflow 2.1.0. I am too facing the same issue stated above.

Traceback (most recent call last):
File "capsule.py", line 162, in
capsule = Capsule(10, 16, 2, True)(x)
File "C:\Python3\lib\site-packages\keras\backend\tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "C:\Python3\lib\site-packages\keras\engine\base_layer.py", line 489, in call
output = self.call(inputs, **kwargs)
File "capsule.py", line 121, in call
b = K.batch_dot(o, hat_inputs, [2, 3])
File "C:\Python3\lib\site-packages\keras\backend\tensorflow_backend.py", line 1499, in batch_dot
'y.shape[%d] (%d != %d).' % (axes[0], axes[1], d1, d2))
ValueError: Can not do batch_dot on inputs with shapes (None, 10, 10, 16) and (None, 10, None, 16) with axes=[2, 3]. x.shape[2] != y.shape[3] (10 != 16).

@Tsai-Cheng-Hong
Copy link

Tsai-Cheng-Hong commented Aug 6, 2022

Hey guys @Rajkumar-Mohan @kbhartiya
I know how to finish this issue
you should watch this 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

4 participants