summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestNeuralNetworksWrapper.h
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2019-01-14 16:31:15 -0800
committerMiao Wang <miaowang@google.com>2019-01-24 18:08:07 -0800
commitf5d41baffcf51fa91880d6ab792accf0e5b2c9ed (patch)
treea6130a6ed55d89c6ab586aaeca9d57c9f41e7b44 /nn/runtime/test/TestNeuralNetworksWrapper.h
parent388c0ef3dd596fc4aa5e554ef4860125e05ce6c7 (diff)
downloadml-f5d41baffcf51fa91880d6ab792accf0e5b2c9ed.tar.gz
Implement NDK interface for NNAPI compilation caching.
Add a new NDK API ANeuralNetworksCompilation_setCaching to set caching information for the compilation object. Create validation tests for the new API. Bug: 119616526 Test: NeuralNetworksTest_static Change-Id: I96638073ba39b26a982588e9868e35a49809014b Merged-In: I96638073ba39b26a982588e9868e35a49809014b (cherry picked from commit 7481a7afa7a55cf790f239f947468b389bf7db22)
Diffstat (limited to 'nn/runtime/test/TestNeuralNetworksWrapper.h')
-rw-r--r--nn/runtime/test/TestNeuralNetworksWrapper.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/nn/runtime/test/TestNeuralNetworksWrapper.h b/nn/runtime/test/TestNeuralNetworksWrapper.h
index 6a0551b8b..73c8dbe10 100644
--- a/nn/runtime/test/TestNeuralNetworksWrapper.h
+++ b/nn/runtime/test/TestNeuralNetworksWrapper.h
@@ -24,6 +24,7 @@
#include <math.h>
#include <optional>
+#include <string>
#include <vector>
namespace android {
@@ -329,6 +330,11 @@ class Compilation {
mCompilation, static_cast<int32_t>(preference)));
}
+ Result setCaching(const std::string& cacheDir, const std::vector<uint8_t>& token) {
+ return static_cast<Result>(ANeuralNetworksCompilation_setCaching(
+ mCompilation, cacheDir.c_str(), token.data()));
+ }
+
Result finish() { return static_cast<Result>(ANeuralNetworksCompilation_finish(mCompilation)); }
ANeuralNetworksCompilation* getHandle() const { return mCompilation; }