You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
When I try to run the code routers_regularization.py I get the following error:
244 ######build the model#########
245 encoder = MLP()
--> 246 m1, m1_r = MultiHeadsAttModel(l=neighbors)
247 m2, m2_r = MultiHeadsAttModel(l=neighbors)
248 q_net = Q_Net(action_dim = action_space)
in (x)
214 att = Lambda(lambda x: K.batch_dot(x[0],x[1] ,axes=[3,3]) / np.sqrt(dv))([q,k])# l, nv, nv
215 att_ = Lambda(lambda x: K.softmax(x))(att)
--> 216 out = Lambda(lambda x: K.batch_dot(x[0], x[1],axes=[3,2]))([att, v])
217 out = Lambda(lambda x: K.permute_dimensions(x, (0,2,1,3)))(out)
218
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in batch_dot(x, y, axes)
1259 str(x_shape) + ' and ' + str(y_shape) +
1260 ' with axes=' + str(axes) + '. x.shape[%d] != '
-> 1261 'y.shape[%d] (%d != %d).' % (axes[0], axes[1], d1, d2))
1262
1263 # backup ndims. Need them later.
ValueError: Can not do batch_dot on inputs with shapes (None, 8, 4, 8, 4) and (None, 8, 4, 16) with axes=[3, 2]. x.shape[3] != y.shape[2] (8 != 4).
Kindly tell me what is causing the error so that I can fix it.
The text was updated successfully, but these errors were encountered:
Hi,
When I try to run the code routers_regularization.py I get the following error:
244 ######build the model#########
245 encoder = MLP()
--> 246 m1, m1_r = MultiHeadsAttModel(l=neighbors)
247 m2, m2_r = MultiHeadsAttModel(l=neighbors)
248 q_net = Q_Net(action_dim = action_space)
4 frames
in MultiHeadsAttModel(l, d, dv, dout, nv)
214 att = Lambda(lambda x: K.batch_dot(x[0],x[1] ,axes=[3,3]) / np.sqrt(dv))([q,k])# l, nv, nv
215 att_ = Lambda(lambda x: K.softmax(x))(att)
--> 216 out = Lambda(lambda x: K.batch_dot(x[0], x[1],axes=[3,2]))([att, v])
217 out = Lambda(lambda x: K.permute_dimensions(x, (0,2,1,3)))(out)
218
/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py in call(self, inputs, **kwargs)
449 # Actually call the layer,
450 # collecting output(s), mask(s), and shape(s).
--> 451 output = self.call(inputs, **kwargs)
452 output_mask = self.compute_mask(inputs, previous_mask)
453
/usr/local/lib/python3.6/dist-packages/keras/layers/core.py in call(self, inputs, mask)
714 else:
715 self._input_dtypes = K.dtype(inputs)
--> 716 return self.function(inputs, **arguments)
717
718 def compute_mask(self, inputs, mask=None):
in (x)
214 att = Lambda(lambda x: K.batch_dot(x[0],x[1] ,axes=[3,3]) / np.sqrt(dv))([q,k])# l, nv, nv
215 att_ = Lambda(lambda x: K.softmax(x))(att)
--> 216 out = Lambda(lambda x: K.batch_dot(x[0], x[1],axes=[3,2]))([att, v])
217 out = Lambda(lambda x: K.permute_dimensions(x, (0,2,1,3)))(out)
218
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in batch_dot(x, y, axes)
1259 str(x_shape) + ' and ' + str(y_shape) +
1260 ' with axes=' + str(axes) + '. x.shape[%d] != '
-> 1261 'y.shape[%d] (%d != %d).' % (axes[0], axes[1], d1, d2))
1262
1263 # backup ndims. Need them later.
ValueError: Can not do batch_dot on inputs with shapes (None, 8, 4, 8, 4) and (None, 8, 4, 16) with axes=[3, 2]. x.shape[3] != y.shape[2] (8 != 4).
Kindly tell me what is causing the error so that I can fix it.
The text was updated successfully, but these errors were encountered: