I have two numpy arrays
a = numpy.array([1, 0])
b = numpy.array([[0.2, 0.4, 0.1],
[0.8, 0.5, 0.3]])
I want to subtract b
from a
.
If I write a[0] - b[0]
I get [0.8, 0.6, 0.9]
If I write a[1] - b[1]
I get [-0.8, -0.5, -0.3]
Subtraction between these arrays is obviously possible, but if I write a - b
, I get this:
ValueError: operands could not be broadcast together with shapes (2,) (2,3)
Why is this not possible?