summaryrefslogtreecommitdiff
path: root/nn/common/OperationsUtils.cpp
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2020-11-02 23:17:11 -0800
committerMichael Butler <butlermichael@google.com>2020-11-06 18:15:52 -0800
commitca7a45a1234977c93fdfb578b64114d13ee27b7f (patch)
treee96b673d1baeb8853e54e1812cfb57a0036a4231 /nn/common/OperationsUtils.cpp
parentd6f4f1ed9fea50529006a0aa3436e4bce4decd05 (diff)
downloadml-ca7a45a1234977c93fdfb578b64114d13ee27b7f.tar.gz
Make operation validation return Result<Version>
Bug: N/A Test: mma Test: NeuralNetworksTest_static Change-Id: I47c12e13fcb41f832e31043b3f14e7b93472b0f8 Merged-In: I47c12e13fcb41f832e31043b3f14e7b93472b0f8 (cherry picked from commit 72146e08363add234a71d19accd96325cb77ce7c)
Diffstat (limited to 'nn/common/OperationsUtils.cpp')
-rw-r--r--nn/common/OperationsUtils.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/nn/common/OperationsUtils.cpp b/nn/common/OperationsUtils.cpp
index d65566f96..c5a71e981 100644
--- a/nn/common/OperationsUtils.cpp
+++ b/nn/common/OperationsUtils.cpp
@@ -86,8 +86,9 @@ bool validateOutputTypes(const IOperationValidationContext* context,
[context](uint32_t index) { return context->getOutputType(index); });
}
-bool validateVersion(const IOperationValidationContext* context, Version minSupportedVersion) {
- if (context->getVersion() < minSupportedVersion) {
+bool validateVersion(const IOperationValidationContext* context, Version contextVersion,
+ Version minSupportedVersion) {
+ if (contextVersion < minSupportedVersion) {
std::ostringstream message;
message << "Operation " << context->getOperationName() << " with inputs {";
for (uint32_t i = 0, n = context->getNumInputs(); i < n; ++i) {
@@ -104,7 +105,7 @@ bool validateVersion(const IOperationValidationContext* context, Version minSupp
message << context->getOutputType(i);
}
message << "} is only supported since " << minSupportedVersion << " (validating using "
- << context->getVersion() << ")";
+ << contextVersion << ")";
NN_RET_CHECK_FAIL() << message.str();
}
return true;