W3cubDocs

/TensorFlow 2.3

tf.keras.backend.dot

View source on GitHub

Multiplies 2 tensors (and/or variables) and returns a tensor.

Arguments
x Tensor or variable.
y Tensor or variable.
Returns
A tensor, dot product of x and y.

Examples:

x = tf.keras.backend.placeholder(shape=(2, 3))
y = tf.keras.backend.placeholder(shape=(3, 4))
xy = tf.keras.backend.dot(x, y)
xy
<tf.Tensor ... shape=(2, 4) dtype=float32>
x = tf.keras.backend.placeholder(shape=(32, 28, 3))
y = tf.keras.backend.placeholder(shape=(3, 4))
xy = tf.keras.backend.dot(x, y)
xy
<tf.Tensor ... shape=(32, 28, 4) dtype=float32>
x = tf.keras.backend.random_uniform_variable(shape=(2, 3), low=0, high=1)
y = tf.keras.backend.ones((4, 3, 5))
xy = tf.keras.backend.dot(x, y)
tf.keras.backend.int_shape(xy)
(2, 4, 5)

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/backend/dot