summaryrefslogtreecommitdiff
path: root/runtime/libs/tflite/src/Diff.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/libs/tflite/src/Diff.cpp')
-rw-r--r--runtime/libs/tflite/src/Diff.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/libs/tflite/src/Diff.cpp b/runtime/libs/tflite/src/Diff.cpp
index 879de0735..9e66bbb5d 100644
--- a/runtime/libs/tflite/src/Diff.cpp
+++ b/runtime/libs/tflite/src/Diff.cpp
@@ -86,8 +86,8 @@ bool TfLiteInterpMatchApp::compareSingleTensorView(const nnfw::tflite::TensorVie
std::vector<nnfw::misc::tensor::Diff<T>> diffs;
assert(expected.shape() == obtained.shape());
- using nnfw::misc::tensor::zip;
using nnfw::misc::tensor::Index;
+ using nnfw::misc::tensor::zip;
zip(expected.shape(), expected, obtained)
<< [&](const Index &index, T expected_value, T obtained_value) {
@@ -296,6 +296,18 @@ template <> bool RandomGenerator::generate<bool>(void)
return dist(_rand);
}
+template <> int32_t RandomGenerator::generate<int32_t>(void)
+{
+ // Instead of INT_MAX, 4096 is chosen because int32_t input does not mean
+ // that the model can have any value in int32_t can hold.
+ // For example, one_hot operation gets indices as int32_t tensor.
+ // However, we usually expect it would hold a value in [0..depth).
+ // In our given model, depth was 10137.
+ const int int32_random_max = 4096;
+ std::uniform_int_distribution<> dist(0, int32_random_max);
+ return dist(_rand);
+}
+
#include "tflite/TensorLogger.h"
//
// Random Test Runner
@@ -615,7 +627,8 @@ RandomTestRunner RandomTestRunner::make(uint32_t seed)
param.verbose = nnfw::misc::EnvVar("VERBOSE").asInt(0);
param.tolerance = nnfw::misc::EnvVar("TOLERANCE").asInt(1);
- ;
+ param.tensor_logging = nnfw::misc::EnvVar("TENSOR_LOGGING").asBool(false);
+ param.log_path = nnfw::misc::EnvVar("TENSOR_LOGGING").asString("tensor_log.txt");
return RandomTestRunner{seed, param};
}