ndenumerate#

ivy.ndenumerate(input)[source]#

Multidimensional index iterator.

Parameters:

input (Iterable) – Input array to iterate over.

Return type:

Generator

Returns:

ret – An iterator yielding pairs of array coordinates and values.

Examples

>>> a = ivy.array([[1, 2], [3, 4]])
>>> for index, x in ivy.ndenumerate(a):
>>>     print(index, x)
(0, 0) 1
(0, 1) 2
(1, 0) 3
(1, 1) 4