Kaspersky Neuromorphic Platform  1.0.0
API Reference
Loading...
Searching...
No Matches
knp::framework::ModelLoader Class Reference

The ModelLoader class is a definition of a loader that uploads the model to the specified backend. More...

#include <knp/framework/model_loader.h>

+ Collaboration diagram for knp::framework::ModelLoader:

Public Types

using InputChannelMap = std::unordered_map<core::UID, io::input::DataGenerator, core::uid_hash>
 Type of the input channel map.
 

Public Member Functions

 ModelLoader (std::shared_ptr< core::Backend > backend, InputChannelMap i_map)
 Model loader constructor.
 
 ModelLoader (const ModelLoader &)=delete
 Avoid copy of ModelLoader.
 
ModelLoader operator= (const ModelLoader &)=delete
 Avoid copy assignment of ModelLoader.
 
void load (knp::framework::Model &model)
 Write model to backend.
 
io::output::OutputChannelget_output_channel (const core::UID &channel_uid)
 Get reference to output channel.
 
const io::output::OutputChannelget_output_channel (const core::UID &channel_uid) const
 Get reference to output channel.
 
io::input::InputChannelget_input_channel (const core::UID &channel_uid)
 Get reference to input channel by its UID.
 
const io::input::InputChannelget_input_channel (const core::UID &channel_uid) const
 Get reference to input channel by its UID.
 
auto & get_inputs () noexcept
 Get input channels.
 
auto & get_outputs () noexcept
 Get output channels.
 
std::shared_ptr< core::Backendget_backend ()
 Get pointer to backend object.
 

Detailed Description

The ModelLoader class is a definition of a loader that uploads the model to the specified backend.

Definition at line 45 of file model_loader.h.

Member Typedef Documentation

◆ InputChannelMap

Type of the input channel map.

Definition at line 51 of file model_loader.h.

Constructor & Destructor Documentation

◆ ModelLoader()

knp::framework::ModelLoader::ModelLoader ( std::shared_ptr< core::Backend > backend,
InputChannelMap i_map )
inline

Model loader constructor.

Parameters
backendpointer to backend to which you want to load the model.
i_mapinput channel map.

Definition at line 59 of file model_loader.h.

Member Function Documentation

◆ get_backend()

std::shared_ptr< core::Backend > knp::framework::ModelLoader::get_backend ( )
inline

Get pointer to backend object.

Returns
shared pointer to Backend object.

Definition at line 129 of file model_loader.h.

◆ get_input_channel() [1/2]

io::input::InputChannel & knp::framework::ModelLoader::get_input_channel ( const core::UID & channel_uid)

Get reference to input channel by its UID.

Parameters
channel_uidchannel UID.
Returns
reference to input channel.
Exceptions
std::runtime_errorif no channel with the given UID exists.

◆ get_input_channel() [2/2]

const io::input::InputChannel & knp::framework::ModelLoader::get_input_channel ( const core::UID & channel_uid) const

Get reference to input channel by its UID.

Note
Constant method.
Parameters
channel_uidchannel UID.
Returns
reference to input channel.
Exceptions
std::runtime_errorif no channel with the given UID exists.

◆ get_inputs()

auto & knp::framework::ModelLoader::get_inputs ( )
inlinenoexcept

Get input channels.

Returns
tuple of input channel vectors.

Definition at line 117 of file model_loader.h.

◆ get_output_channel() [1/2]

io::output::OutputChannel & knp::framework::ModelLoader::get_output_channel ( const core::UID & channel_uid)

Get reference to output channel.

Parameters
channel_uidchannel UID.
Returns
reference to output channel.
Exceptions
std::runtime_errorif there is no channel with a given UID.

◆ get_output_channel() [2/2]

const io::output::OutputChannel & knp::framework::ModelLoader::get_output_channel ( const core::UID & channel_uid) const

Get reference to output channel.

Note
Constant method.
Parameters
channel_uidchannel UID.
Returns
reference to output channel.
Exceptions
std::runtime_errorif there is no channel with a given UID.

◆ get_outputs()

auto & knp::framework::ModelLoader::get_outputs ( )
inlinenoexcept

Get output channels.

Returns
tuple of output channel vectors.

Definition at line 123 of file model_loader.h.

◆ load()

void knp::framework::ModelLoader::load ( knp::framework::Model & model)

Write model to backend.

Parameters
modelmodel to load.

The documentation for this class was generated from the following file: