I am looking for an optimized way of computing a element wise multiplication of a 2d array by each slice of a 3d array (using numpy).
for example:
w = np.array([[1,5], [4,9], [12,15]])
y = np.ones((3,2,3))
I want to get a result as a 3d array with the same shape as y
.
Broadcasting using the * operator is not allowed. In my case, the third dimensions is very long and a for loop is not convenient.