#include <MetricPrinter.h>
Definition at line 139 of file MetricPrinter.h.
◆ accumulate()
void circle_eval_diff::MPEIRPrinter::accumulate |
( |
const std::vector< std::shared_ptr< Tensor > > & |
first, |
|
|
const std::vector< std::shared_ptr< Tensor > > & |
second |
|
) |
| |
|
virtual |
Implements circle_eval_diff::MetricPrinter.
Definition at line 366 of file MetricPrinter.cpp.
368{
369 assert(first.size() == second.size());
370 assert(first.size() == _intermediate.size());
371
372 for (uint32_t output_idx = 0; output_idx < _intermediate.size(); output_idx++)
373 {
374 const auto first_output = first[output_idx];
375 const auto second_output = second[output_idx];
376
377
378 const auto fp32_first_output = fp32(first_output);
379 const auto fp32_second_output = fp32(second_output);
380
381 accum_peir(output_idx, fp32_first_output, fp32_second_output);
382 }
383
384 _num_data++;
385}
◆ dump()
void circle_eval_diff::MPEIRPrinter::dump |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Implements circle_eval_diff::MetricPrinter.
Definition at line 387 of file MetricPrinter.cpp.
388{
389 os << "Mean Peak Error to Interval Ratio (MPEIR)" << std::endl;
390
391 for (uint32_t output_idx = 0; output_idx < _intermediate.size(); output_idx++)
392 {
393 const auto name = _output_names.at(output_idx);
394 const auto sum_of_peir = _intermediate.at(output_idx);
395
396
397 float mpeir = sum_of_peir / _num_data;
398
399 os << "MPEIR for " << name << " is " << mpeir << std::endl;
400 }
401}
◆ init()
Reimplemented from circle_eval_diff::MetricPrinter.
Definition at line 300 of file MetricPrinter.cpp.
301{
304
307
308 assert(first_output.size() == second_output.size());
309
310 for (uint32_t i = 0; i < first_output.size(); i++)
311 {
312 const auto first_node = loco::must_cast<luci::CircleOutput *>(first_output[i]);
313 const auto second_node = loco::must_cast<luci::CircleOutput *>(second_output[i]);
314
315
316 _intermediate.emplace_back(0.0);
317
318
319 _output_names.emplace_back(first_node->name());
320 }
321}
#define THROW_UNLESS(COND, MSG)
loco::Graph * graph(void) const
provide main graph
std::vector< Node * > output_nodes(Graph *)
References luci::Module::graph(), loco::output_nodes(), and THROW_UNLESS.
The documentation for this class was generated from the following files: