1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

[G-API] Allow unused nodes in Fluid backend

Allow nodes produced after some operation to be
"unused": not being an output and not being used
as inputs to other operations

Add fluid test to cover this case
This commit is contained in:
Andrey Golubev
2019-03-18 18:13:44 +03:00
parent 26087e28ad
commit dd2823aaec
2 changed files with 29 additions and 0 deletions
@@ -1399,6 +1399,20 @@ void GFluidBackendImpl::addBackendPasses(ade::ExecutionEngineSetupContext &ectx)
// will be copied by views on each iteration and base our choice
// on this criteria)
auto readers = node->outNodes();
// There can be a situation when __internal__ nodes produced as part of some
// operation are unused later in the graph:
//
// in -> OP1
// |------> internal_1 // unused node
// |------> internal_2 -> OP2
// |------> out
//
// To allow graphs like the one above, skip nodes with empty outNodes()
if (readers.empty()) {
continue;
}
const auto &candidate = ade::util::find_if(readers, [&](ade::NodeHandle nh) {
return fg.metadata(nh).contains<FluidUnit>() &&
fg.metadata(nh).get<FluidUnit>().border_size == fd.border_size;