summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestNeuralNetworksWrapper.h
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2020-04-03 16:18:25 -0700
committerDavid Gross <dgross@google.com>2020-04-06 13:58:53 -0700
commit69bb69ddb1d1febe4a0557dd6460c9bd0311c4f7 (patch)
tree01c67ff2baf0282956a75343d153ae3bd3e72e47 /nn/runtime/test/TestNeuralNetworksWrapper.h
parent802473f5081d3ab4a36b3296c452554ecbfdf51a (diff)
downloadml-69bb69ddb1d1febe4a0557dd6460c9bd0311c4f7.tar.gz
Add more tests for getOutputOperand*() and for burst and fenced execution
Test that getOutputOperand*() fails with ANEURALNETWORKS_BAD_STATE if called on a running Execution. Bring burstCompute() and startComputeWithDependencies() testing to parity with compute() and startCompute() testing: Ensure that driver errors are handled properly, and that getOutputOperand*() is handled properly. Also add NeuralNetworksWrapper::startComputeWithDependencies(). Bug: 148804027 Test: NeuralNetworksTest_static --gtest_filter=*ExecutionTest*Wait* Change-Id: I7cca4d43d7f6369845d7fedac4e37ca2cc8b7afe
Diffstat (limited to 'nn/runtime/test/TestNeuralNetworksWrapper.h')
-rw-r--r--nn/runtime/test/TestNeuralNetworksWrapper.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/nn/runtime/test/TestNeuralNetworksWrapper.h b/nn/runtime/test/TestNeuralNetworksWrapper.h
index 53ba5d291..6ac33dfee 100644
--- a/nn/runtime/test/TestNeuralNetworksWrapper.h
+++ b/nn/runtime/test/TestNeuralNetworksWrapper.h
@@ -22,6 +22,7 @@
#include <math.h>
+#include <algorithm>
#include <optional>
#include <string>
#include <utility>
@@ -382,6 +383,18 @@ class Execution {
return result;
}
+ Result startComputeWithDependencies(const std::vector<const Event*>& dependencies,
+ uint64_t duration, Event* event) {
+ std::vector<const ANeuralNetworksEvent*> deps(dependencies.size());
+ std::transform(dependencies.begin(), dependencies.end(), deps.begin(),
+ [](const Event* e) { return e->getHandle(); });
+ ANeuralNetworksEvent* ev = nullptr;
+ Result result = static_cast<Result>(ANeuralNetworksExecution_startComputeWithDependencies(
+ mExecution, deps.data(), deps.size(), duration, &ev));
+ event->set(ev);
+ return result;
+ }
+
Result compute() {
switch (mComputeMode) {
case ComputeMode::SYNC: {