summaryrefslogtreecommitdiff
path: root/nn/runtime
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2020-05-13 17:17:32 -0700
committerStephen Hines <srhines@google.com>2020-05-14 23:57:31 -0700
commit23e00af42c1171286547e132ec3eaabb472fe9ea (patch)
tree073b4372899bac63208b4aa6f1a4c85d77850ff2 /nn/runtime
parente87eb356123eca6200e3a58eda82df38b0a68b02 (diff)
downloadml-23e00af42c1171286547e132ec3eaabb472fe9ea.tar.gz
Fix incorrect (and inverted) comparison.
This test was incorrectly passing this comparison before because the uninitialized value in `that.channelQuant->scales` was 0xaaaa... instead of not needing to be compared at all when `channelQuant` isn't set. Now we check whether to examine `scales` at all. Bug: http://b/156464649 Bug: http://b/156514991 Test: atest CtsNNAPITestCases:TensorRankConstraint Change-Id: I1f4db99bdd63e5dc1c95f574e6eca3adfffd138d (cherry picked from commit 63deac05d3a1d53430966a49c6979554f128383d)
Diffstat (limited to 'nn/runtime')
-rw-r--r--nn/runtime/test/TestValidateOperations.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/nn/runtime/test/TestValidateOperations.cpp b/nn/runtime/test/TestValidateOperations.cpp
index 4ac4f8d7d..01e4338d7 100644
--- a/nn/runtime/test/TestValidateOperations.cpp
+++ b/nn/runtime/test/TestValidateOperations.cpp
@@ -107,13 +107,17 @@ struct OperandTypeWithExtraParams {
}
}
- if (channelQuant.has_value() && channelQuant->scales) {
- return that.channelQuant->scales &&
- std::equal(channelQuant->scales, channelQuant->scales + channelQuant->scaleCount,
- that.channelQuant->scales);
- } else {
- return that.channelQuant->scales != nullptr;
+ if (channelQuant.has_value()) {
+ if (channelQuant->scales) {
+ return that.channelQuant->scales &&
+ std::equal(channelQuant->scales,
+ channelQuant->scales + channelQuant->scaleCount,
+ that.channelQuant->scales);
+ } else {
+ return that.channelQuant->scales == nullptr;
+ }
}
+ return true;
}
bool operator!=(const OperandTypeWithExtraParams& that) const { return !(*this == that); }