ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir_onnx::ConverterContext Class Reference

#include <ONNXNodeConverterRegistry.h>

Public Member Functions

 ConverterContext (mir::Graph *graph)
 
 ~ConverterContext ()=default
 
void setOutput (const std::string &name, mir::Operation::Output *output)
 
mir::Operation::OutputgetOutput (const std::string &name) const
 
std::vector< mir::Operation::Output * > getNodeInputs (const onnx::NodeProto &onnx_node) const
 
void setNodeOutputs (const onnx::NodeProto &onnx_node, const std::vector< mir::Operation::Output * > &outputs)
 
mir::GraphgetGraph () const
 

Detailed Description

Definition at line 42 of file ONNXNodeConverterRegistry.h.

Constructor & Destructor Documentation

◆ ConverterContext()

mir_onnx::ConverterContext::ConverterContext ( mir::Graph graph)
explicit

Definition at line 59 of file ONNXNodeConverterRegistry.cpp.

59: _graph(graph) {}

◆ ~ConverterContext()

mir_onnx::ConverterContext::~ConverterContext ( )
default

Member Function Documentation

◆ getGraph()

◆ getNodeInputs()

std::vector< mir::Operation::Output * > mir_onnx::ConverterContext::getNodeInputs ( const onnx::NodeProto &  onnx_node) const

Definition at line 79 of file ONNXNodeConverterRegistry.cpp.

80{
81 const auto &input_names = onnx_node.input();
82 std::vector<mir::Operation::Output *> outputs;
83
84 for (const auto &input_name : input_names)
85 {
86 if (!input_name.empty())
87 {
88 auto *mir_output = getOutput(input_name);
89 assert(mir_output != nullptr);
90 outputs.emplace_back(mir_output);
91 }
92 }
93 return outputs;
94}
mir::Operation::Output * getOutput(const std::string &name) const

References getOutput().

Referenced by mir_onnx::convertAddV7(), mir_onnx::convertAveragePoolV1(), mir_onnx::convertBatchNormalizationV9(), mir_onnx::convertConcatV1(), mir_onnx::convertConcatV4(), mir_onnx::convertConstantV1(), mir_onnx::convertConvTransposeV1(), mir_onnx::convertConvV1(), mir_onnx::convertDivV7(), mir_onnx::convertDropoutV10(), mir_onnx::convertEqualV11(), mir_onnx::convertExpandV8(), mir_onnx::convertFlattenV1(), mir_onnx::convertGatherV1(), mir_onnx::convertGlobalAveragePoolV2(), mir_onnx::convertIdentityV1(), mir_onnx::convertMatMulV1(), mir_onnx::convertMaxPoolV1(), mir_onnx::convertMulV7(), mir_onnx::convertPadAttrName(), mir_onnx::convertReduceMeanV1(), mir_onnx::convertReshapeV1(), mir_onnx::convertReshapeV5(), mir_onnx::convertShapeV1(), mir_onnx::convertSoftmaxV1(), mir_onnx::convertSubV7(), mir_onnx::convertSumV8(), mir_onnx::convertTransposeV1(), mir_onnx::convertUnsqueezeV1(), mir_onnx::convertUpsampleV1(), mir_onnx::convertUpsampleV7(), and mir_onnx::convertUpsampleV9().

◆ getOutput()

mir::Operation::Output * mir_onnx::ConverterContext::getOutput ( const std::string &  name) const

Definition at line 69 of file ONNXNodeConverterRegistry.cpp.

70{
71 auto iter = _tensorNameToOutput.find(name);
72 if (iter == _tensorNameToOutput.end())
73 return nullptr;
74 else
75 return iter->second;
76}

Referenced by getNodeInputs().

◆ setNodeOutputs()

void mir_onnx::ConverterContext::setNodeOutputs ( const onnx::NodeProto &  onnx_node,
const std::vector< mir::Operation::Output * > &  outputs 
)

◆ setOutput()

void mir_onnx::ConverterContext::setOutput ( const std::string &  name,
mir::Operation::Output output 
)

Definition at line 61 of file ONNXNodeConverterRegistry.cpp.

62{
63 output->setName(name);
64 auto result = _tensorNameToOutput.emplace(name, output);
65 if (!result.second)
66 throw std::runtime_error("Name duplication: " + name);
67}
result
Definition infer.py:103

Referenced by setNodeOutputs().


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