Like array_equal, but doesn't actually compare values. Returns True when arr1, arr2 identical or their dask tokens are equal. Returns False when shapes are not equal. Returns None when equality cannot determined: one or both of arr1, arr2 are numpy arrays; or their dask tokens are no
(arr1, arr2)
| 319 | |
| 320 | |
| 321 | def lazy_array_equiv(arr1, arr2): |
| 322 | """Like array_equal, but doesn't actually compare values. |
| 323 | Returns True when arr1, arr2 identical or their dask tokens are equal. |
| 324 | Returns False when shapes are not equal. |
| 325 | Returns None when equality cannot determined: one or both of arr1, arr2 are numpy arrays; |
| 326 | or their dask tokens are not equal |
| 327 | """ |
| 328 | if arr1 is arr2: |
| 329 | return True |
| 330 | arr1 = asarray(arr1) |
| 331 | arr2 = asarray(arr2) |
| 332 | if arr1.shape != arr2.shape: |
| 333 | return False |
| 334 | if dask_available and is_duck_dask_array(arr1) and is_duck_dask_array(arr2): |
| 335 | from dask.base import tokenize |
| 336 | |
| 337 | # GH3068, GH4221 |
| 338 | if tokenize(arr1) == tokenize(arr2): |
| 339 | return True |
| 340 | else: |
| 341 | return None |
| 342 | return None |
| 343 | |
| 344 | |
| 345 | def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8): |
no test coverage detected
searching dependent graphs…