1.
from keras.layers.merge import dot
x = tf.constant([[1,2,3]])
>>> dot([x,x],axes=1)
<tf.Tensor 'dot_8/ExpandDims:0' shape=(1, 1) dtype=int32>
2.
import tensorflow.keras.backend as K
y = tf.constant([[1],[2],[3]])
>>> K.dot(x, y)
<tf.Tensor 'MatMul_5:0' shape=(1, 1) dtype=int32>
3.
>>> x = tf.constant([[1, 2], [3, 4]])
>>> y = tf.constant([[5, 6], [7, 8]])
>>> sess.run(dot([x,y], axes=1)) #按行点积
array([[17], 17 =1*5 + 2* 6
[53]], dtype=int32)
>>> sess.run(dot([x,y], axes=0)) #按列点积
array([[26], 26=1*5+3*7
[44]], dtype=int32)