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