Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf.keras.backend.dot

TensorFlow 1 version View source on GitHub

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

tf.keras.backend.dot(
    x, y
)

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)