ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Utils.h File Reference

This file contains utility macro. More...

#include "ir/Coordinates.h"
#include "ir/Shape.h"

Go to the source code of this file.

Data Structures

struct  ForEachDimension< rest >
 
struct  ForEachDimension< 0 >
 

Functions

template<typename L >
void ShapeLoop (const onert::ir::Shape &shape, L lambda_function)
 

Detailed Description

This file contains utility macro.

Definition in file Utils.h.

Function Documentation

◆ ShapeLoop()

template<typename L >
void ShapeLoop ( const onert::ir::Shape shape,
lambda_function 
)
inline

Definition at line 60 of file Utils.h.

61{
62 int32_t rank = shape.rank();
63 assert(rank > 0);
64 for (int32_t i = 0; i < rank; ++i)
65 {
66 assert(shape.dim(i) > 0);
67 }
68
70 if (rank == 0)
71 {
72 coords.set(0, 0);
73 }
74 // TODO Change 6 to onert::ir::Shape::kMaxRank if onert::ir::Shape::kMaxRank is modified as a
75 // constant expression
76 ForEachDimension<6>::unroll(shape, coords, lambda_function);
77}
Array< CornerBox > coords
Class to represent position(offset) of tensor. Assume that the front is higher dimensional....
Definition Coordinates.h:37
void set(size_t dimension, int32_t coordinate)
Set the coordinate of one of the coordinates.
Definition Coordinates.h:79
static void unroll(const onert::ir::Shape &shape, onert::ir::Coordinates &coords, L lambda_function)
Definition Utils.h:31

References coords, onert::ir::Coordinates::set(), and ForEachDimension< rest >::unroll().

Referenced by onert::exec::CopyDynamic(), and onert::exec::UpdateOffsets().