From 12be7ab4876f77fecfab903df70791623219b3da Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 3 Jul 2018 12:06:23 +0100 Subject: COMPMID-1310: Create graph validation executables. Change-Id: I9e0b57b1b83fe5a95777cdaeddba6ecef650bafc Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/138697 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- src/graph/detail/ExecutionHelpers.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/graph/detail/ExecutionHelpers.cpp') diff --git a/src/graph/detail/ExecutionHelpers.cpp b/src/graph/detail/ExecutionHelpers.cpp index d68092a2e7..6df67fcfec 100644 --- a/src/graph/detail/ExecutionHelpers.cpp +++ b/src/graph/detail/ExecutionHelpers.cpp @@ -206,15 +206,12 @@ void call_all_const_node_accessors(Graph &g) } } -void call_all_input_node_accessors(ExecutionWorkload &workload) +bool call_all_input_node_accessors(ExecutionWorkload &workload) { - for(auto &input : workload.inputs) + return !std::any_of(std::begin(workload.inputs), std::end(workload.inputs), [](Tensor * input_tensor) { - if(input != nullptr) - { - input->call_accessor(); - } - } + return (input_tensor == nullptr) || !input_tensor->call_accessor(); + }); } void prepare_all_tasks(ExecutionWorkload &workload) @@ -256,15 +253,15 @@ void call_all_tasks(ExecutionWorkload &workload) } } -void call_all_output_node_accessors(ExecutionWorkload &workload) +bool call_all_output_node_accessors(ExecutionWorkload &workload) { - for(auto &output : workload.outputs) + bool is_valid = true; + std::for_each(std::begin(workload.outputs), std::end(workload.outputs), [&](Tensor * output_tensor) { - if(output != nullptr) - { - output->call_accessor(); - } - } + is_valid = is_valid && (output_tensor != nullptr) && output_tensor->call_accessor(); + }); + + return is_valid; } } // namespace detail } // namespace graph -- cgit v1.2.1