import numpy as np
A = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
B = np.array([[9, 8, 7], [6, 5, 4], [3, 2, 1]])
# This method computes the dot product of A and B in a more efficient
# way by using Einstein summation.
print(np.einsum("ij,ji->i", A, B))