title: Matrix Subtraction | ValueError: operands could not be broadcast together with shapes (1,30) (30,455)
body: <p>I am performing what seemingly appears to be a legal operation in Linear Algebra but not for Numpy Python.</p>
  <p>To give context; I am manually setting up an ANN, performing Backpropagation.</p>
  <p>Here, I &quot;Transpose&quot; the <code>w</code> (weights) 1D-array (by converting it to a matrix and then transposing).
  Below is my trouble-making code:</p>
  <pre><code>w = w.T
  ans = l*dEdW
  w = np.subtract(w, ans)
  #w = w - l*dEdW
  </code></pre>
  <pre><code>ValueError: operands could not be broadcast together with shapes (1,30) (30,455) 
  </code></pre>
  <p>Mathematically:
  As long as the no. columns of the first matrix <code>w</code> is equal to the no. rows in the second matrix <code>yield of l*dEdW</code>, then A-ok.</p>
  <p>In terms of Numpy, where am I going wrong?</p>
  <p>Note: attempting the below line instead also yields the same error:</p>
  <pre><code>w -= l*dEdW  # ideally
  </code></pre>
  <p>Update:
  <code>print(dEdW)</code> shows a matrix of <code>NaNs</code>. I suspect this to be the issue, as the shape is correct but has no content.</p>
  <p>I can only &quot;Accept&quot; one answer it seems. All comments and answers were insightful. I believe this to be a separate issue. Thanks everyone</p>