assert(pure->inputs() == nnapi->inputs());
- // Fill IFM with random numbers
- for (const auto id : pure->inputs())
- {
- assert(pure->tensor(id)->type == nnapi->tensor(id)->type);
-
- // NOTE Float inputs are supported currently
+ auto floatgen = [&](int id, ::tflite::Interpreter *pure, ::tflite::Interpreter *nnapi) {
assert(pure->tensor(id)->type == kTfLiteFloat32);
assert(nnapi->tensor(id)->type == kTfLiteFloat32);
pure_view.at(ind) = value;
nnapi_view.at(ind) = value;
};
+ };
+
+ // Fill IFM with random numbers
+ for (const auto id : pure->inputs())
+ {
+ assert(pure->tensor(id)->type == nnapi->tensor(id)->type);
+ switch (pure->tensor(id)->type)
+ {
+ case kTfLiteFloat32:
+ {
+ floatgen(id, pure.get(), nnapi.get());
+ break;
+ }
+ default:
+ {
+ throw std::runtime_error{"Not supported input type"};
+ }
+ }
}
std::cout << "[NNAPI TEST] Run T/F Lite Interpreter without NNAPI" << std::endl;