title: Test if two numpy arrays are (close to) equal, including shape
body: <p>I want to test if two numpy arrays are (close to) equal, so I've been using the <code>np.allclose</code> function. The only problem is, it returns <code>True</code> if given a two-dimensional matrix and a three-dimensional matrix of equal elements.</p>
  
  <pre><code>import numpy as np
  
  x = np.array([[3.14159265, -0.1], [-0.1, 0.1]])
  
  y = np.array([[math.pi, -0.1], [-0.1, 0.1]])
  
  z1 = np.array([[[3.14159265, -0.1], [-0.1, 0.1]],
                [[3.14159265, -0.1], [-0.1, 0.1]]])
  z2 = np.array([[[math.pi, -0.1], [-0.1, 0.1]],
                [[math.pi, -0.1], [-0.1, 0.1]]])  
  
  
  np.allclose(x,y)
  # Returns true, as expected
  
  np.allclose(x,z1)
  # Also returns true, even though matrices are different shapes. Unwanted.
  </code></pre>
  
  <p>Now, I know about <code>np.array_equal</code>, which compares elements and shape, but it doesn't allow me to test if the elements are close, only if they are equal. For instance,</p>
  
  <pre><code>np.array_equal(x,y)
  </code></pre>
  
  <p>Returns <code>False</code></p>
  
  <p>Is there a function I can use that will return true for <code>(x,y)</code> and <code>(z1,z2)</code> but false for <code>(x,z1)</code> in this case?</p>