numpy.tile(A, reps) #or if you want to do it along a new axis: np.repeat(A, reps, axis = 0)
Here is what the above code is Doing:
1. Create an array of ones with the same shape as A.
2. Multiply each element of A by the corresponding element of B.
3. Sum the elements of the resulting array along the given axis.