[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../c-api/../generated/numpy.array_equiv.html [Back]  [Original]

numpy.array_equiv — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.array_equiv#

numpy.array_equiv(a1, a2)[source]#

Returns True if input arrays are shape consistent and all elements equal.

Shape consistent means they are either the same shape, or one input array can be broadcasted to create the same shape as the other one.

Parameters:
a1, a2array_like

Input arrays.

Returns:
outbool

True if equivalent, False otherwise.

Examples

Try it in your browser!
>>> import numpy as np
>>> np.array_equiv([1, 2], [1, 2])
True
>>> np.array_equiv([1, 2], [1, 3])
False

Showing the shape equivalence:

>>> np.array_equiv([1, 2], [[1, 2], [1, 2]])
True
>>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]])
False
>>> np.array_equiv([1, 2], [[1, 2], [1, 3]])
False

Web Proxy Viewer  |  New URL  |  Original Page