title: Subtract each row of matrix A from every row of matrix B without loops
body: <p>Given two arrays, <code>A</code> (shape: M X C) and <code>B</code> (shape: N X C), is there a way to subtract each row of <code>A</code> from each row of <code>B</code> without using loops? The final output would be of shape (M N X C).</p>
  <hr />
  <h3>Example</h3>
  <pre><code>A = np.array([[  1,   2,   3], 
                [100, 200, 300]])
  
  B = np.array([[  10,   20,   30],
                [1000, 2000, 3000],
                [ -10,  -20,   -2]])
  </code></pre>
  <p>Desired result (can have some other shape) (edited):</p>
  <pre><code>array([[  -9,   -18,   -27],
         [-999, -1998, -2997],
         [  11,    22,     5],
         [  90,   180,   270],
         [-900, -1800, -2700],
         [ 110,   220,   302]])
  
  Shape: 6 X 3
  </code></pre>
  <p><em>(Loop is too slow, and &quot;outer&quot; subtracts each element instead of each row)</em></p>