Lines Matching refs:model

79 std::vector<bool> identifyUsedOperands(const Model& model) {  in identifyUsedOperands()  argument
80 std::vector<bool> used(model.main.operands.size(), false); in identifyUsedOperands()
85 for (const auto& operation : model.main.operations) { in identifyUsedOperands()
89 markUsed(model.main.inputIndexes); in identifyUsedOperands()
90 CHECK_EQ(used.size(), model.main.operands.size()); in identifyUsedOperands()
134 std::vector<bool> identifyUsedSubgraphs(const Model& model) { in identifyUsedSubgraphs() argument
135 std::vector<bool> used(model.referenced.size(), false); in identifyUsedSubgraphs()
136 identifyUsedSubgraphs(model.main.operands, model.referenced, &used); in identifyUsedSubgraphs()
137 CHECK_EQ(used.size(), model.referenced.size()); in identifyUsedSubgraphs()
155 std::vector<bool> identifyUsedPools(const Model& model) { in identifyUsedPools() argument
156 std::vector<bool> used(model.pools.size(), false); in identifyUsedPools()
157 identifyUsedPools(model.main, &used); in identifyUsedPools()
158 for (const auto& subgraph : model.referenced) { in identifyUsedPools()
161 CHECK_EQ(used.size(), model.pools.size()); in identifyUsedPools()
215 void fixOperandDataLocations(Model* model, const std::vector<uint32_t>& remappedPoolIndex, in fixOperandDataLocations() argument
217 const auto operandValues = std::exchange(model->operandValues, Model::OperandValues{}); in fixOperandDataLocations()
218 fixOperandDataLocations(&model->main.operands, &model->operandValues, operandValues, in fixOperandDataLocations()
220 for (auto& subgraph : model->referenced) { in fixOperandDataLocations()
221 fixOperandDataLocations(&subgraph.operands, &model->operandValues, operandValues, in fixOperandDataLocations()
228 std::vector<bool> identifyUsedExtensions(const Model& model) { in identifyUsedExtensions() argument
242 collectPrefixes(model.main); in identifyUsedExtensions()
243 for (const auto& subgraph : model.referenced) { in identifyUsedExtensions()
248 used.reserve(model.extensionNameToPrefix.size()); in identifyUsedExtensions()
249 for (const auto& extension : model.extensionNameToPrefix) { in identifyUsedExtensions()
252 CHECK_EQ(used.size(), model.extensionNameToPrefix.size()); in identifyUsedExtensions()
258 void removeDeadOperands(Model* model) { in removeDeadOperands() argument
259 CHECK(model != nullptr); in removeDeadOperands()
262 const auto operandsUsed = identifyUsedOperands(*model); in removeDeadOperands()
263 keepSelectedElements(&model->main.operands, operandsUsed); in removeDeadOperands()
267 for (auto& operation : model->main.operations) { in removeDeadOperands()
271 remapIndexes(&model->main.inputIndexes, mappedOperandIndices); in removeDeadOperands()
272 remapIndexes(&model->main.outputIndexes, mappedOperandIndices); in removeDeadOperands()
275 const auto subgraphsUsed = identifyUsedSubgraphs(*model); in removeDeadOperands()
276 keepSelectedElements(&model->referenced, subgraphsUsed); in removeDeadOperands()
279 const auto poolsUsed = identifyUsedPools(*model); in removeDeadOperands()
280 keepSelectedElements(&model->pools, poolsUsed); in removeDeadOperands()
285 fixOperandDataLocations(model, mappedPoolIndices, mappedSubgraphIndices); in removeDeadOperands()
288 const auto extensionsUsed = identifyUsedExtensions(*model); in removeDeadOperands()
289 keepSelectedElements(&model->extensionNameToPrefix, extensionsUsed); in removeDeadOperands()