Introduction
In this chapter we will present network build option that improves performance. Note this option can change memory layouts. This chapter also shows how to get primitives profiling info.
#include <../api/CPP/cldnn_defs.h>
#include <../api/CPP/engine.hpp>
#include <../api/CPP/input_layout.hpp>
#include <../api/CPP/memory.hpp>
#include <../api/CPP/data.hpp>
#include <../api/CPP/topology.hpp>
#include <../api/CPP/network.hpp>
#include <iostream>
#include <chrono>
#include "helper_functions.h"
{
std::cout << std::endl << "-- Chapter 5 --" << std::endl;
set_values(input_prim, { -3.0f, -2.0f, 2.5f });
{
std::cout << "optimized " << it.first << std::endl;
auto mem_pointer = it.second.get_memory().pointer<float>();
for (auto i : mem_pointer)
{
std::cout << i << " ";
}
std::cout << std::endl;
}
std::vector<cldnn::instrumentation::profiling_info> profiling_table;
{
profiling_table.push_back({ p.first, p.second.get_event().get_profiling_info() });
}
for (auto& p : profiling_table)
{
std::cout << p.name << ":" << std::endl;
for (auto& q : p.intervals)
{
std::cout << "\t" << q.name << ": " << std::chrono::duration_cast<std::chrono::duration<double, std::chrono::nanoseconds::period>>(q.value->value()).count()
<< " nanoseconds" << std::endl;
}
}
}