-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Closed
Closed
Copy link
Labels
type:docsNeed to modify the documentationNeed to modify the documentation
Description
Doc Issue
The doc of keras.layers.dot()
shows its description as below:
keras/keras/src/layers/merging/dot.py
Lines 364 to 365 in 3fac66f
axes: Integer or tuple of integers, | |
axis or axes along which to take the dot product. |
For the repro below, I accept that it should raise error, but needed to be noted in the docstring, using tf v2.20.0-rc0-4-g72fbba3d20f 2.20.0
and keras
latest:
Repro
import tensorflow as tf
import keras
tensor1 = tf.random.uniform((1, 10), maxval=100, minval=0, dtype=tf.float32)
tensor2 = tf.random.uniform((1, 10), maxval=100, minval=0, dtype=tf.float32)
dot_product = keras.layers.dot([tensor1, tensor2], axes=0)
print(dot_product)
Output
Cannot perform batch_dot over axis 0. If your inputs are not batched, add a dummy batch dimension to your inputs using keras.ops.expand_dims(x, 0)
Arguments received by Dot.call():
• inputs=['tf.Tensor(shape=(1, 10), dtype=float32)', 'tf.Tensor(shape=(1, 10), dtype=float32)']
The related error is reported here:
keras/keras/src/layers/merging/dot.py
Lines 102 to 109 in 3fac66f
# sanity checks | |
if 0 in axes: | |
raise ValueError( | |
"Cannot perform batch_dot over axis 0. " | |
"If your inputs are not batched, " | |
"add a dummy batch dimension to your " | |
"inputs using keras.ops.expand_dims(x, 0)" | |
) |
Thanks a lot!
Metadata
Metadata
Assignees
Labels
type:docsNeed to modify the documentationNeed to modify the documentation