ONE - On-device Neural Engine
Loading...
Searching...
No Matches
locomotiv Namespace Reference

Data Structures

struct  BinaryFunc
 
struct  NodeData
 Read-only no-template wrapper for 'Buffer'. Serves interface for input and output of 'Session'. More...
 
class  NodeDataImpl
 An implementation of NodeData interface. More...
 
struct  NodeDomain
 
class  NodeExecution
 Helper class for Session, responsible to process one node calculation. More...
 
class  Session
 Session for loco graph inference. More...
 
struct  UnaryFunc
 

Functions

template<typename DT >
std::unique_ptr< NodeDatamake_data (const NodeData::Buffer< DT > &buffer)
 Copy buffer to make NodeData.
 
template<>
std::unique_ptr< NodeDatamake_data (const NodeData::Buffer< int32_t > &buf)
 
template<>
std::unique_ptr< NodeDatamake_data (const NodeData::Buffer< float > &buf)
 
void annot_domain (loco::Node *node, const loco::Domain &domain)
 Wrapper to annotate domain to node. Cannot annotate unknown domain.
 
loco::Domain annot_domain (const loco::Node *node)
 Wrapper to get domain annotation of node.
 
void erase_annot_domain (loco::Node *node)
 Erase already annotated node domain.
 
void validate (bool true_cond, const std::string &&exception_msg)
 

Function Documentation

◆ annot_domain() [1/2]

loco::Domain locomotiv::annot_domain ( const loco::Node node)

Wrapper to get domain annotation of node.

Definition at line 42 of file NodeDomain.cpp.

43{
44 auto node_domain = node->annot<NodeDomain>();
45 if (node_domain)
46 return node_domain->value;
47 else
49}
const T * annot(void) const
Retrieve a stored annotation of type T.

References loco::AnnotatedItem< Annotation >::annot(), loco::Unknown, and locomotiv::NodeDomain::value.

◆ annot_domain() [2/2]

void locomotiv::annot_domain ( loco::Node node,
const loco::Domain domain 
)

Wrapper to annotate domain to node. Cannot annotate unknown domain.

Definition at line 34 of file NodeDomain.cpp.

35{
36 assert(domain != loco::Domain::Unknown);
37 auto node_domain = std::unique_ptr<NodeDomain>(new NodeDomain(domain));
38 assert(node_domain);
39 node->annot(std::move(node_domain));
40}

References loco::AnnotatedItem< Annotation >::annot(), and loco::Unknown.

◆ erase_annot_domain()

void locomotiv::erase_annot_domain ( loco::Node node)

Erase already annotated node domain.

Definition at line 51 of file NodeDomain.cpp.

51{ node->annot<NodeDomain>(nullptr); }

References loco::AnnotatedItem< Annotation >::annot().

Referenced by locomotiv::Session::~Session().

◆ make_data() [1/3]

template<typename DT >
std::unique_ptr< NodeData > locomotiv::make_data ( const NodeData::Buffer< DT > &  buffer)

Copy buffer to make NodeData.

Note
NodeData is read-only. You may prepare buffer with ALL data, then call this function to make data.

References make_data().

Referenced by make_data(), make_data(), make_data(), and nnkit::support::moco::tf::Backend::prepare().

◆ make_data() [2/3]

template<>
std::unique_ptr< NodeData > locomotiv::make_data ( const NodeData::Buffer< float > &  buf)

Definition at line 28 of file NodeData.cpp.

29{
30 return std::unique_ptr<NodeDataImpl>(new NodeDataImpl(buf));
31}
An implementation of NodeData interface.

References make_data().

◆ make_data() [3/3]

template<>
std::unique_ptr< NodeData > locomotiv::make_data ( const NodeData::Buffer< int32_t > &  buf)

Definition at line 23 of file NodeData.cpp.

24{
25 return std::unique_ptr<NodeDataImpl>(new NodeDataImpl(buf));
26}

References make_data().

◆ validate()

void locomotiv::validate ( bool  true_cond,
const std::string &&  exception_msg 
)
inline

Definition at line 26 of file Validation.h.

27{
28 if (!true_cond)
29 throw std::runtime_error(exception_msg);
30}