diff options
author | Xusong Wang <xusongw@google.com> | 2019-01-23 21:57:14 -0800 |
---|---|---|
committer | Xusong Wang <xusongw@google.com> | 2019-01-28 11:03:39 -0800 |
commit | e68352ca850e89fd9a130c65f2e8b8613c790d2f (patch) | |
tree | cdbd20d58722ae8eb737182da79f4a84913868bb /nn/runtime/test/TestNeuralNetworksWrapper.h | |
parent | 3d98beef0082065e81a88d44052a555275588e49 (diff) | |
download | ml-e68352ca850e89fd9a130c65f2e8b8613c790d2f.tar.gz |
Refine documentation for compilation caching.
Also let mToken in CompilationBuilder to use an array,
and add a check in NeuralNetworksWrapper on token size.
Bug: 119616526
Test: NeuralNetworksTest_static
Change-Id: Ic8d4a39cb28905bd7829ff8a39412855bb354e57
Merged-In: Ic8d4a39cb28905bd7829ff8a39412855bb354e57
(cherry picked from commit f6d736557dca4737a3b00979c501163f68515dd3)
Diffstat (limited to 'nn/runtime/test/TestNeuralNetworksWrapper.h')
-rw-r--r-- | nn/runtime/test/TestNeuralNetworksWrapper.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nn/runtime/test/TestNeuralNetworksWrapper.h b/nn/runtime/test/TestNeuralNetworksWrapper.h index bf854d749..50292f929 100644 --- a/nn/runtime/test/TestNeuralNetworksWrapper.h +++ b/nn/runtime/test/TestNeuralNetworksWrapper.h @@ -336,6 +336,9 @@ class Compilation { } Result setCaching(const std::string& cacheDir, const std::vector<uint8_t>& token) { + if (token.size() != ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN) { + return Result::BAD_DATA; + } return static_cast<Result>(ANeuralNetworksCompilation_setCaching( mCompilation, cacheDir.c_str(), token.data())); } |