return compareSingleTensorView(expected, obtained, id);
};
+ comparators[kTfLiteBool] = [this](int id, ::tflite::Interpreter &interp,
+ ::tflite::Interpreter &nnapi) {
+ const auto expected = nnfw::support::tflite::TensorView<bool>::make(interp, id);
+ const auto obtained = nnfw::support::tflite::TensorView<bool>::make(nnapi, id);
+
+ return compareSingleTensorView(expected, obtained, id);
+ };
+
for (const auto &id : interp.outputs())
{
assert(interp.tensor(id)->type == nnapi.tensor(id)->type);
};
};
+ initializers[kTfLiteBool] = [&](int id, Interpreter *tfl_interp, Interpreter *nnapi) {
+ assert(tfl_interp->tensor(id)->type == kTfLiteBool);
+ assert(nnapi->tensor(id)->type == kTfLiteBool);
+
+ auto tfl_interp_view = nnfw::support::tflite::TensorView<bool>::make(*tfl_interp, id);
+ auto nnapi_view = nnfw::support::tflite::TensorView<bool>::make(*nnapi, id);
+
+ assert(tfl_interp_view.shape() == nnapi_view.shape());
+
+ auto fp = static_cast<bool (RandomGenerator::*)(const ::nnfw::util::tensor::Shape &,
+ const ::nnfw::util::tensor::Index &)>(
+ &RandomGenerator::generate<bool>);
+ const nnfw::util::tensor::Object<bool> 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) {
+ const auto value = data.at(ind);
+
+ tfl_interp_view.at(ind) = value;
+ nnapi_view.at(ind) = value;
+ };
+ };
+
+ reseters[kTfLiteBool] = [&](int id, Interpreter *tfl_interp, Interpreter *nnapi) {
+ assert(tfl_interp->tensor(id)->type == kTfLiteBool);
+ assert(nnapi->tensor(id)->type == kTfLiteBool);
+
+ auto tfl_interp_view = nnfw::support::tflite::TensorView<bool>::make(*tfl_interp, id);
+ auto nnapi_view = nnfw::support::tflite::TensorView<bool>::make(*nnapi, id);
+
+ assert(tfl_interp_view.shape() == nnapi_view.shape());
+
+ auto fp = static_cast<bool (RandomGenerator::*)(const ::nnfw::util::tensor::Shape &,
+ const ::nnfw::util::tensor::Index &)>(
+ &RandomGenerator::generate<bool>);
+ const nnfw::util::tensor::Object<bool> data(tfl_interp_view.shape(),
+ std::bind(fp, _randgen, _1, _2));
+
+ assert(tfl_interp_view.shape() == data.shape());
+
+ bool value = false;
+
+ nnfw::util::tensor::iterate(tfl_interp_view.shape())
+ << [&](const nnfw::util::tensor::Index &ind) {
+ tfl_interp_view.at(ind) = value;
+ nnapi_view.at(ind) = value;
+ };
+ };
+
// Fill IFM with random numbers
for (const auto id : tfl_interp->inputs())
{