_plan.operations().at(_plan.operations().size() - 1).name() = name;
}
+#ifdef TFLITE_PROFILING_ENABLED
+public:
+ int plan_op_size() const { return _plan.operations().size(); }
+ void addOpIndexToSteps(int from, int to, int op_idx)
+ {
+ for (int i = from; i < to; ++i)
+ _plan.operations().at(i).op_idx() = op_idx;
+ }
+#endif
+
private:
::internal::arm_compute::Plan &_plan;
};
AllocationContext allocation_context{_plan};
ExecutionBuilder execution_builder{_plan};
- for (const auto &stage : _stages)
+ for (int idx = 0; idx < _stages.size(); idx++)
{
+ const auto &stage = _stages[idx];
+#ifdef TFLITE_PROFILING_ENABLED
+ int from = execution_builder.plan_op_size();
+#endif
stage(allocation_context, execution_builder);
+#ifdef TFLITE_PROFILING_ENABLED
+ int to = execution_builder.plan_op_size();
+ execution_builder.addOpIndexToSteps(from, to, idx);
+#endif
}
// Allocate Tensor Memory
for (uint32_t n = 0; n < operations.size(); ++n)
{
auto prof = profiling::Context::get().getProfiler();
- SCOPED_OPERATOR_PROFILE(prof, n);
+ SCOPED_OPERATOR_PROFILE(prof, operations.at(n).op_idx());
operations.at(n).run();
if (sync)
private:
std::string _name;
std::unique_ptr<::arm_compute::IFunction> _func;
+#ifdef TFLITE_PROFILING_ENABLED
+public:
+ int op_idx() const { return _op_idx; }
+ int &op_idx() { return _op_idx; }
+private:
+ int _op_idx;
+#endif
};
} // namespace op