The dot product between two tensors can be performed using:
tf.matmul(a, b)
A full example is given below:
# Build a graph
graph = tf.Graph()
with graph.as_default():
# A 2x3 matrix
a = tf.constant(np.array([[1, 2, 3],
[2, 4, 6]]),
dtype=tf.float32)
# A 3x2 matrix
b = tf.constant(np.array([[1, 10],
[2, 20],
[3, 30]]),
dtype=tf.float32)
# Perform dot product
c = tf.matmul(a, b)
# Run a Session
with tf.Session(graph=graph) as session:
output = session.run(c)
print(output)
prints out
[[ 14. 140.]
[ 28. 280.]]