NumPy's rule for combining arrays of different shapes by stretching size-1 dimensions, so no manual copying is needed.
a = np.ones((3, 4))
b = np.array([1, 2, 3, 4]) # shape (4,)
(a + b).shape # (3, 4)NumPy's rule for combining arrays of different shapes by stretching size-1 dimensions, so no manual copying is needed.
a = np.ones((3, 4))
b = np.array([1, 2, 3, 4]) # shape (4,)
(a + b).shape # (3, 4)