ONE - On-device Neural Engine
Loading...
Searching...
No Matches
tflinspect::DumpOperatorVersion Class Referencefinal

#include <Dump.h>

Collaboration diagram for tflinspect::DumpOperatorVersion:

Public Member Functions

 DumpOperatorVersion ()=default
 
void run (std::ostream &os, const tflite::Model *model)
 
- Public Member Functions inherited from tflinspect::DumpInterface
virtual ~DumpInterface ()=default
 

Detailed Description

Definition at line 54 of file Dump.h.

Constructor & Destructor Documentation

◆ DumpOperatorVersion()

tflinspect::DumpOperatorVersion::DumpOperatorVersion ( )
default

Member Function Documentation

◆ run()

void tflinspect::DumpOperatorVersion::run ( std::ostream &  os,
const tflite::Model *  model 
)
virtual

Implements tflinspect::DumpInterface.

Definition at line 148 of file Dump.cpp.

149{
150 std::map<std::string, int32_t> op_version_map;
151
152 tflinspect::Reader reader(model);
153
154 const uint32_t subgraph_size = reader.num_subgraph();
155
156 for (uint32_t g = 0; g < subgraph_size; g++)
157 {
158 reader.select_subgraph(g);
159 auto ops = reader.operators();
160
161 // dump Conv2D, DepthwiseConv2D and its weight input operator
162 for (uint32_t i = 0; i < ops->size(); ++i)
163 {
164 const auto op = ops->Get(i);
165
166 auto op_name = reader.opcode_name(op);
167 auto op_version = reader.opcodes().at(op->opcode_index())->version();
168
169 if (op_version_map.find(op_name) == op_version_map.end() ||
170 op_version_map[op_name] < op_version)
171 op_version_map[op_name] = op_version;
172 }
173 }
174
175 for (auto op : op_version_map)
176 {
177 os << op.first << "," << op.second << std::endl;
178 }
179}
Loads TF lite file and provides helpers to access attributes.
Definition Reader.h:43

References tflinspect::Reader::num_subgraph(), tflinspect::Reader::opcode_name(), tflinspect::Reader::opcodes(), tflinspect::Reader::operators(), and tflinspect::Reader::select_subgraph().

Referenced by package.infer.session::inference().


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