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;
44 inputInfos.push_back(&infos[0]);
45 inputInfos.push_back(&infos[1]);
46 outputInfos.push_back(&infos[2]);
49 for (
unsigned int i = 0; i < infos.size() - 1; ++i)
51 inputInfos.push_back(&infos[i]);
53 outputInfos.push_back(&infos.back());
56 outputInfos.push_back(&infos[0]);
60 inputInfos.push_back(&infos[0]);
61 outputInfos.push_back(&infos[1]);
62 inputInfos.push_back(&infos[2]);
64 auto conv2dDesc = PolymorphicDowncast<const Convolution2dDescriptor*>(&descriptor);
65 if(conv2dDesc->m_BiasEnabled)
67 inputInfos.push_back(&infos[3]);
76 inputInfos.push_back(&infos[0]);
77 outputInfos.push_back(&infos[1]);
81 inputInfos.push_back(&infos[0]);
82 outputInfos.push_back(&infos[1]);
83 inputInfos.push_back(&infos[2]);
85 auto conv2dDesc = PolymorphicDowncast<const TransposeConvolution2dDescriptor*>(&descriptor);
86 if(conv2dDesc->m_BiasEnabled)
88 inputInfos.push_back(&infos[3]);
97 auto mappings =
GetTosaMapping(
nullptr, type, inputInfos, outputInfos, descriptor);
98 if (mappings->GetName() ==
"")
104 TosaSerializationHandler handler;
107 auto* block =
new TosaSerializationBasicBlock(
"main",
109 mappings->GetOperators(),
110 mappings->GetTensors(),
111 mappings->GetInputs(),
112 mappings->GetOutputs());
114 std::vector<TosaSerializationBasicBlock*> blocks;
115 blocks.emplace_back(block);
118 auto* region =
new TosaSerializationRegion(
"main", blocks);
119 handler.GetRegions().emplace_back(region);
122 TosaReference::IModelRunner runner;
124 #if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
127 func_debug_t funcDebug;
129 FILE* file = fopen(
"/dev/null",
"w");
130 funcDebug.func_debug_file = (file ==
nullptr) ? stderr : file;
132 runner.setFuncDebug(funcDebug);
136 status = runner.initialize(handler);
138 #if !defined(TOSA_REFERENCE_MODEL_OUTPUT)
140 funcDebug.func_debug_file = stderr;
141 runner.setFuncDebug(funcDebug);
144 if(status == GraphStatus::TOSA_ERROR || status == GraphStatus::TOSA_UNPREDICTABLE)