13 #include <graph_status.h>
14 #include <model_runner.h>
22 const std::vector<TensorInfo>& infos,
32 std::vector<const TensorInfo*> inputInfos;
33 std::vector<const TensorInfo*> outputInfos;
38 inputInfos.push_back(&infos[0]);
39 outputInfos.push_back(&infos[1]);
49 inputInfos.push_back(&infos[0]);
50 inputInfos.push_back(&infos[1]);
51 outputInfos.push_back(&infos[2]);
54 for (
unsigned int i = 0; i < infos.size() - 1; ++i)
56 inputInfos.push_back(&infos[i]);
58 outputInfos.push_back(&infos.back());
61 outputInfos.push_back(&infos[0]);
65 inputInfos.push_back(&infos[0]);
66 outputInfos.push_back(&infos[1]);
67 inputInfos.push_back(&infos[2]);
69 auto conv2dDesc = PolymorphicDowncast<const Convolution2dDescriptor*>(&descriptor);
70 if(conv2dDesc->m_BiasEnabled)
72 inputInfos.push_back(&infos[3]);
84 inputInfos.push_back(&infos[0]);
85 outputInfos.push_back(&infos[1]);
90 inputInfos.push_back(&infos[0]);
91 for (
unsigned int i = 1; i < infos.size(); ++i)
93 outputInfos.push_back(&infos[i]);
99 inputInfos.push_back(&infos[0]);
100 outputInfos.push_back(&infos[1]);
101 inputInfos.push_back(&infos[2]);
103 auto conv2dDesc = PolymorphicDowncast<const TransposeConvolution2dDescriptor*>(&descriptor);
104 if(conv2dDesc->m_BiasEnabled)
106 inputInfos.push_back(&infos[3]);
115 auto mappings =
GetTosaMapping(
nullptr, type, inputInfos, outputInfos, descriptor);
116 if (mappings->GetName() ==
"")
122 TosaSerializationHandler handler;
125 auto* block =
new TosaSerializationBasicBlock(
"main",
127 mappings->GetOperators(),
128 mappings->GetTensors(),
129 mappings->GetInputs(),
130 mappings->GetOutputs());
132 std::vector<TosaSerializationBasicBlock*> blocks;
133 blocks.emplace_back(block);
136 auto* region =
new TosaSerializationRegion(
"main", blocks);
137 handler.GetRegions().emplace_back(region);
140 TosaReference::IModelRunner runner;
142 #if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
145 func_debug_t funcDebug;
147 FILE* file = fopen(
"/dev/null",
"w");
148 funcDebug.func_debug_file = (file ==
nullptr) ? stderr : file;
150 runner.setFuncDebug(funcDebug);
154 status = runner.initialize(handler);
156 #if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
158 funcDebug.func_debug_file = stderr;
159 runner.setFuncDebug(funcDebug);
162 if(status == GraphStatus::TOSA_ERROR || status == GraphStatus::TOSA_UNPREDICTABLE)