Write a NumPy program to create an inner product of two arrays.
import numpy as np x = np.arange(24).reshape((2,3,4)) print("Array x:") print(x) print("Array y:") y = np.arange(4) print(y) print("Inner of x and y arrays:") print(np.inner(x, y))
Sample Output:
Array x: [[[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]] [[12 13 14 15] [16 17 18 19] [20 21 22 23]]] Array y: [0 1 2 3] Inner of x and y arrays: [[ 14 38 62] [ 86 110 134]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer