| 89 | } |
| 90 | |
| 91 | void FlexModelTest::AddTfLiteMulOp(const std::vector<int>& inputs, |
| 92 | const std::vector<int>& outputs) { |
| 93 | ++next_op_index_; |
| 94 | |
| 95 | static TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; |
| 96 | reg.builtin_code = BuiltinOperator_MUL; |
| 97 | reg.prepare = [](TfLiteContext* context, TfLiteNode* node) { |
| 98 | auto* i0 = &context->tensors[node->inputs->data[0]]; |
| 99 | auto* o = &context->tensors[node->outputs->data[0]]; |
| 100 | return context->ResizeTensor(context, o, TfLiteIntArrayCopy(i0->dims)); |
| 101 | }; |
| 102 | reg.invoke = [](TfLiteContext* context, TfLiteNode* node) { |
| 103 | auto* i0 = &context->tensors[node->inputs->data[0]]; |
| 104 | auto* i1 = &context->tensors[node->inputs->data[1]]; |
| 105 | auto* o = &context->tensors[node->outputs->data[0]]; |
| 106 | for (int i = 0; i < o->bytes / sizeof(float); ++i) { |
| 107 | o->data.f[i] = i0->data.f[i] * i1->data.f[i]; |
| 108 | } |
| 109 | return kTfLiteOk; |
| 110 | }; |
| 111 | |
| 112 | CHECK_EQ(interpreter_->AddNodeWithParameters(inputs, outputs, nullptr, 0, |
| 113 | nullptr, ®), |
| 114 | kTfLiteOk); |
| 115 | } |
| 116 | |
| 117 | void FlexModelTest::AddTfOp(TfOpType op, const std::vector<int>& inputs, |
| 118 | const std::vector<int>& outputs) { |
nothing calls this directly
no test coverage detected