diff options
author | Xusong Wang <xusongw@google.com> | 2020-04-22 20:15:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-22 20:15:52 +0000 |
commit | 4771108bc09751db04c64971473dd4f4d5cebbf7 (patch) | |
tree | 904b85fe6da1ba9e50620d06101b667ba1adbcc2 /nn/runtime/test/fuzzing | |
parent | 4c9cf95a1684d43bdd7e7c07059f3d41743a6138 (diff) | |
parent | b822394e13b92f22422fad8c5a3a7dbca214b40d (diff) | |
download | ml-4771108bc09751db04c64971473dd4f4d5cebbf7.tar.gz |
Merge changes I85577481,I43ed11e9 into rvc-dev
* changes:
Add STRIDED_SLICE with shrinkMask in RGG tests.
Increase the fp precision in dumped spec.
Diffstat (limited to 'nn/runtime/test/fuzzing')
-rw-r--r-- | nn/runtime/test/fuzzing/operation_signatures/Selection.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nn/runtime/test/fuzzing/operation_signatures/Selection.cpp b/nn/runtime/test/fuzzing/operation_signatures/Selection.cpp index 185644092..6d45d0433 100644 --- a/nn/runtime/test/fuzzing/operation_signatures/Selection.cpp +++ b/nn/runtime/test/fuzzing/operation_signatures/Selection.cpp @@ -280,8 +280,7 @@ static void stridedSliceConstructor(TestOperandType, uint32_t rank, RandomOperat setFreeDimensions(op->inputs[0], rank); std::vector<bool> shrinkMask(rank, false); for (uint32_t i = 0; i < rank; i++) { - // TODO: Currently shrinkMask is always set to false. - shrinkMask[i] = false; + shrinkMask[i] = getBernoulli(0.2f); int32_t stride = getUniform<int32_t>(1, 3); op->inputs[3]->value<int32_t>(i) = stride; if (!shrinkMask[i]) { @@ -303,7 +302,8 @@ static void stridedSliceFinalizer(RandomOperation* op) { for (uint32_t i = 0, o = 0; i < rank; i++) { int32_t inputSize = op->inputs[0]->dimensions[i].getValue(); int32_t stride = op->inputs[3]->value<int32_t>(i); - if ((shrinkMask & (1 << i)) == 0) { + bool shrink = shrinkMask & (1 << i); + if (!shrink) { int32_t outputSize = op->outputs[0]->dimensions[o++].getValue(); int32_t maxStart = inputSize - (outputSize - 1) * stride - 1; begin[i] = getUniform<int32_t>(0, maxStart); @@ -328,7 +328,8 @@ static void stridedSliceFinalizer(RandomOperation* op) { } // Switch to negative stride. - if (getBernoulli(0.2f)) { + // TODO(b/154639297): shrinkMask with negative stride will produce uninitialized output. + if (!shrink && getBernoulli(0.2f)) { op->inputs[3]->value<int32_t>(i) = -stride; std::swap(begin[i], end[i]); std::swap(beginMask[i], endMask[i]); |