From 9cb9af352db28574e837a37b06747a6bf331477d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Fri, 6 Jul 2018 15:45:02 +0900 Subject: [PATCH] Enable the kTfLiteUInt8 of the input operands in RandomTestRunner to be random value. (#1882) This commit enables the kTfLiteUInt8 of the input operands in RandomTestRunner to be random value. Signed-off-by: jiseob.jang --- libs/support/tflite/src/Diff.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/support/tflite/src/Diff.cpp b/libs/support/tflite/src/Diff.cpp index 50e6843..fca2e68 100644 --- a/libs/support/tflite/src/Diff.cpp +++ b/libs/support/tflite/src/Diff.cpp @@ -309,12 +309,16 @@ int RandomTestRunner::run(const nnfw::support::tflite::interp::Builder &builder) assert(tfl_interp_view.shape() == nnapi_view.shape()); - uint8_t value = 0; + auto fp = static_cast( + &RandomGenerator::generate); + const nnfw::util::tensor::Object data(tfl_interp_view.shape(), + std::bind(fp, _randgen, _1, _2)); + assert(tfl_interp_view.shape() == data.shape()); nnfw::util::tensor::iterate(tfl_interp_view.shape()) << [&](const nnfw::util::tensor::Index &ind) { - // TODO Generate random values - value = (value + 1) & 0xFF; + const auto value = data.at(ind); tfl_interp_view.at(ind) = value; nnapi_view.at(ind) = value; -- 2.7.4