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

#include <CircleImportMetadata.h>

Public Member Functions

 CircleImportMetadata ()=delete
 
 CircleImportMetadata (const luci::CircleReader &reader)
 
const OriginTable origin_table (void)
 Create origin table using _source_table and _op_table in CircleImportMetadata.
 
const std::map< uint32_t, std::string > & source_table (void) const
 
const luci::ExecutionPlanTableexecution_plan_table (void) const
 

Detailed Description

Definition at line 34 of file CircleImportMetadata.h.

Constructor & Destructor Documentation

◆ CircleImportMetadata() [1/2]

luci::CircleImportMetadata::CircleImportMetadata ( )
delete

◆ CircleImportMetadata() [2/2]

luci::CircleImportMetadata::CircleImportMetadata ( const luci::CircleReader reader)

Definition at line 203 of file CircleImportMetadata.cpp.

204{
205 const auto metadata = reader.metadata();
206 for (uint32_t i = 0; i < metadata.size(); ++i)
207 {
208 const auto *meta = metadata[i];
209 assert(meta != nullptr);
210
211 assert(meta->buffer() < reader.buffers().size());
212 assert(reader.buffers()[meta->buffer()] != nullptr);
213 const auto buffer = luci::wrap(reader.buffers()[meta->buffer()]->data());
214
215 assert(meta->name() != nullptr);
216 if (meta->name()->str().compare("ONE_op_table") == 0)
217 _op_table = decoded_op_table(buffer);
218 else if (meta->name()->str().compare("ONE_source_table") == 0)
219 _source_table = decoded_source_table(buffer);
220 else if (meta->name()->str().compare("ONE_execution_plan_table") == 0)
221 _execution_plan_table = decoded_execution_plan(buffer);
222 }
223}
CircleBuffers buffers() const
CircleMetadataSet metadata() const
uint32_t size() const
const T * data() const
VectorWrapper< T > wrap(const flatbuffers::Vector< T > *vec)

References luci::CircleReader::buffers(), luci::VectorWrapper< T >::data(), luci::CircleReader::metadata(), luci::VectorWrapper< T >::size(), and luci::wrap().

Member Function Documentation

◆ execution_plan_table()

const luci::ExecutionPlanTable & luci::CircleImportMetadata::execution_plan_table ( void  ) const
inline

Definition at line 51 of file CircleImportMetadata.h.

51{ return _execution_plan_table; }

◆ origin_table()

const OriginTable luci::CircleImportMetadata::origin_table ( void  )

Create origin table using _source_table and _op_table in CircleImportMetadata.

Note
For creating origin table, both _op_table and _source_table should exist. If one of them does not exist, empty table is returned.

Definition at line 225 of file CircleImportMetadata.cpp.

226{
228
229 if (_op_table.size() > 0 && _source_table.size() > 0)
230 {
231 for (auto &kv : _op_table)
232 {
233 const auto node_id = kv.first;
234 const auto &source_ids = kv.second;
235
236 std::vector<std::shared_ptr<CircleNodeOrigin>> origins;
237 for (auto source_id : source_ids)
238 {
239 const auto &source_name = _source_table.at(source_id);
240 origins.push_back(single_origin(source_id, source_name));
241 }
242
243 auto origin = composite_origin(origins);
244 origin_table.emplace(node_id, origin);
245 }
246 }
247
248 return origin_table;
249}
const OriginTable origin_table(void)
Create origin table using _source_table and _op_table in CircleImportMetadata.
std::shared_ptr< CircleNodeOrigin > composite_origin(const std::initializer_list< std::shared_ptr< CircleNodeOrigin > > origins)
std::map< uint32_t, std::shared_ptr< CircleNodeOrigin > > OriginTable
std::shared_ptr< CircleNodeOrigin > single_origin(uint32_t id, const std::string &name)

References luci::composite_origin(), origin_table(), and luci::single_origin().

Referenced by origin_table().

◆ source_table()

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

Definition at line 49 of file CircleImportMetadata.h.

49{ return _source_table; }

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