I need to sum a normal numpy array with an empty array
<code>x = np.ones([2,3])
x + np.array([]).reshape(2,-1)
</code>
<code>x = np.ones([2,3])
x + np.array([]).reshape(2,-1)
</code>
x = np.ones([2,3])
x + np.array([]).reshape(2,-1)
Output:
<code>ValueError: operands could not be broadcast together with shapes (2,3) (2,0)
</code>
<code>ValueError: operands could not be broadcast together with shapes (2,3) (2,0)
</code>
ValueError: operands could not be broadcast together with shapes (2,3) (2,0)
Reshaping them to other dimensions does not work, e.g. x.reshape(-1) + np.array([])
.
And making an if-statement to see if the right hand side term is empty or not seems not necessary.