import numpy as np a = np.random.rand(5,5,3) b = np.random.rand(5,5) b_reshaped = b.reshape((5,5,1)) c = a * b_reshaped print(c.shape) # c will have dimensions (5,5,3) # remove '#' from the line below to see results #print(c)