I have a 3D numpy array a with shape [M, N, 3], and a 2D array b with shape [M, N]. I want to multiply each of the 3 values in the 3rd dimension of a by the corresponding value in b, which I am currently doing like so:
a[:,:,0] *= b
a[:,:,1] *= b
a[:,:,2] *= b
I was wondering if there is a single-line way to achieve this.
Thanks!