Introduction
In this chapter we will explain how to create primitives, show some kinds of primitives and explain how to build topology.
#include <../api/CPP/cldnn_defs.h>
#include <../api/CPP/engine.hpp>
#include <../api/CPP/input_layout.hpp>
#include <../api/CPP/activation.hpp>
#include <../api/CPP/softmax.hpp>
#include <../api/CPP/memory.hpp>
#include <../api/CPP/fully_connected.hpp>
#include <../api/CPP/data.hpp>
#include <../api/CPP/topology.hpp>
#include <iostream>
#include "helper_functions.h"
{
std::cout << std::endl << "-- Chapter 2 --" << std::endl;
"relu",
"input",
activation_relu);
"softmax",
"relu");
3,
1,
3,
1 } });
set_values(weights_mem, { 1.5f, 1.0f, 0.5f, -1.0f, 0.0f, 0.5f, 0.5f, -0.5f, -2.0f });
data fc_weights(
"fc_weights", weights_mem);
set_values(bias_mem, { 0.0f, 1.0f, 0.5f });
data fc_bias(
"fc_bias", bias_mem);
"fc",
"softmax",
"fc_weights",
"fc_bias"
);
in_layout,
fc,
fc_bias,
fc_weights
);
std::cout << "Topology contains:" << std::endl;
for (
auto it :
topology.get_primitive_ids())
{
std::cout << it << std::endl;
}
}