Class ov::CoordinateIterator

class CoordinateIterator

A useful class that allows to iterate over the tensor coordinates. For example, for tensor with dimensions {2, 3} this iterator produces the following coordinates: {0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {2,2}.

Deprecated:

Public Functions

inline CoordinateIterator(const Shape &target_shape)

Coordinates iterator constructor.

Parameters

target_shape – The target shape for coordinates iteration

void operator++()

The postfix operation increment the iterator by one.

CoordinateIterator operator++(int)

The prefix operation increment the iterator by one.

void operator+=(size_t n)

Increments iterator n times.

Parameters

n – number of elements it should be advanced

const Coordinate &operator*() const noexcept

Iterator dereferencing operator returns reference to current pointed coordinate.

bool operator!=(const CoordinateIterator &it) const noexcept

Checks for iterator inequality.

Parameters

it – second iterator to compare

bool operator==(const CoordinateIterator &it) const noexcept

Checks for iterator equality.

Parameters

it – second iterator to compare

size_t advance(size_t axis) noexcept

Increments iterator using specified axis of the shape n times.

Parameters

axis – index used for iteration

Public Static Functions

static const CoordinateIterator &end()

Useful function to build the last iterator. Returns a singleton that points to the last iterator.