cupy.flatiter

class cupy.flatiter(a)[source]

Flat iterator object to iterate over arrays.

A flatiter iterator is returned by x.flat for any array x. It allows iterating over the array as if it were a 1-D array, either in a for-loop or by calling its next method.

Iteration is done in row-major, C-style order (the last index varying the fastest).

Variables

base (cupy.ndarray) – A reference to the array that is iterated over.

Note

Restricted support of basic slicing is currently supplied. Advanced indexing is not supported yet.

See also

numpy.flatiter()

Methods

__getitem__(ind)[source]
__setitem__(ind, value)[source]
__len__()[source]
__next__()[source]
__iter__()[source]
copy()[source]

Get a copy of the iterator as a 1-D array.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.

Attributes

base

A reference to the array that is iterated over.