MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AddTfLiteMulOp

Method AddTfLiteMulOp

tensorflow/lite/delegates/flex/test_util.cc:91–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void 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, &reg),
114 kTfLiteOk);
115}
116
117void FlexModelTest::AddTfOp(TfOpType op, const std::vector<int>& inputs,
118 const std::vector<int>& outputs) {

Callers

nothing calls this directly

Calls 3

TfLiteIntArrayCopyFunction · 0.85
ResizeTensorMethod · 0.80
AddNodeWithParametersMethod · 0.45

Tested by

no test coverage detected