You need to convert array b to a (2, 1) shape array, use None or numpy.newaxis
in the index tuple:
import numpy
a = numpy.array([[2,3,2],[5,6,1]])
b = numpy.array([3,5])
c = a * b[:, None]
Here is the document.
You need to convert array b to a (2, 1) shape array, use None or numpy.newaxis
in the index tuple:
import numpy
a = numpy.array([[2,3,2],[5,6,1]])
b = numpy.array([3,5])
c = a * b[:, None]
Here is the document.