ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::CircleExportMetadata Class Reference

#include <SerializedData.h>

Public Member Functions

void source_table (const std::map< uint32_t, std::string > &table)
 
void add_op_table (uint32_t node_id, uint32_t source_id)
 
void add_execution_plan_table (uint32_t node_id, const std::vector< uint32_t > &execution_plan_inform)
 
void clear (void)
 
const std::vector< uint8_t > encoded_source_table (void)
 
const std::vector< uint8_t > encoded_op_table (void)
 
const std::vector< uint8_t > encoded_execution_plan_table (void)
 

Detailed Description

Definition at line 52 of file SerializedData.h.

Member Function Documentation

◆ add_execution_plan_table()

void luci::CircleExportMetadata::add_execution_plan_table ( uint32_t  node_id,
const std::vector< uint32_t > &  execution_plan_inform 
)
inline

Definition at line 67 of file SerializedData.h.

69 {
70 _execution_plan_table[node_id] = execution_plan_inform;
71 }

Referenced by luci::exportNodes().

◆ add_op_table()

void luci::CircleExportMetadata::add_op_table ( uint32_t  node_id,
uint32_t  source_id 
)
inline

Definition at line 57 of file SerializedData.h.

58 {
59 // Model with multiple subgraph may have duplicated node id.
60 // For now, as we do not consider about multiple subgraph in profiling,
61 // just ignore those cases and support them in the future.
62 if (_op_table.find(node_id) == _op_table.end())
63 _op_table.emplace(node_id, std::set<uint32_t>());
64 _op_table.at(node_id).emplace(source_id);
65 }

Referenced by luci::exportNodes().

◆ clear()

void luci::CircleExportMetadata::clear ( void  )

Definition at line 22 of file SerializedData.cpp.

23{
24 _source_table.clear();
25 _op_table.clear();
26 _execution_plan_table.clear();
27}

Referenced by luci::SerializedModelData::clear().

◆ encoded_execution_plan_table()

const std::vector< uint8_t > luci::CircleExportMetadata::encoded_execution_plan_table ( void  )

Definition at line 48 of file CircleExportMetadata.cpp.

49{
50 std::vector<uint8_t> data;
51
52 write_u32(data, _execution_plan_table.size());
53
54 for (auto &kv : _execution_plan_table)
55 {
56 const auto id = kv.first;
57 write_u32(data, id);
58
59 const auto &plan_vector = kv.second;
60 const auto size = plan_vector.size();
61 write_u32(data, size);
62
63 for (auto elem : plan_vector)
64 {
65 write_u32(data, elem);
66 }
67 }
68
69 return data;
70}
const T * data(const std::vector< T, Alloc > &v)
int32_t size[5]
Definition Slice.cpp:35

References flatbuffers::data(), and size.

Referenced by luci::createCircleMetadataVector().

◆ encoded_op_table()

const std::vector< uint8_t > luci::CircleExportMetadata::encoded_op_table ( void  )

Definition at line 99 of file CircleExportMetadata.cpp.

100{
101 std::vector<uint8_t> data;
102
103 write_u32(data, _op_table.size());
104
105 for (auto &kv : _op_table)
106 {
107 const auto id = kv.first;
108 write_u32(data, id);
109
110 const auto &origins = kv.second;
111 const auto node_num = origins.size();
112 write_u32(data, node_num);
113
114 for (auto origin : origins)
115 {
116 write_u32(data, origin);
117 }
118 }
119
120 return data;
121}

References flatbuffers::data().

Referenced by luci::createCircleMetadataVector().

◆ encoded_source_table()

const std::vector< uint8_t > luci::CircleExportMetadata::encoded_source_table ( void  )

Definition at line 73 of file CircleExportMetadata.cpp.

74{
75 std::vector<uint8_t> data;
76
77 write_u32(data, _source_table.size());
78
79 for (auto &kv : _source_table)
80 {
81 const auto id = kv.first;
82 write_u32(data, id);
83
84 const auto &origin_name = kv.second;
85 const auto length = origin_name.length();
86 write_u32(data, length + 1); // name + '\0
87
88 for (uint32_t i = 0; i < length; ++i)
89 {
90 data.emplace_back(origin_name.at(i));
91 }
92 data.emplace_back('\0');
93 }
94
95 return data;
96}

References flatbuffers::data().

Referenced by luci::createCircleMetadataVector().

◆ source_table()

void luci::CircleExportMetadata::source_table ( const std::map< uint32_t, std::string > &  table)
inline

Definition at line 55 of file SerializedData.h.

55{ _source_table = table; }

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