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

Function Prepare

tensorflow/lite/kernels/embedding_lookup.cc:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48namespace embedding_lookup {
49
50TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
51 TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
52 TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
53
54 const TfLiteTensor* lookup = GetInput(context, node, 0);
55 TF_LITE_ENSURE_EQ(context, NumDimensions(lookup), 1);
56 TF_LITE_ENSURE_EQ(context, lookup->type, kTfLiteInt32);
57
58 const TfLiteTensor* value = GetInput(context, node, 1);
59 TF_LITE_ENSURE(context, NumDimensions(value) >= 2);
60
61 TfLiteTensor* output = GetOutput(context, node, 0);
62 TfLiteIntArray* outputSize = TfLiteIntArrayCreate(NumDimensions(value));
63
64 outputSize->data[0] = SizeOfDimension(lookup, 0);
65 outputSize->data[1] = SizeOfDimension(value, 1);
66 for (int i = 2; i < NumDimensions(value); i++) {
67 outputSize->data[i] = SizeOfDimension(value, i);
68 }
69 return context->ResizeTensor(context, output, outputSize);
70}
71
72TfLiteStatus EvalSimple(TfLiteContext* context, TfLiteNode* node,
73 const TfLiteTensor* lookup, const TfLiteTensor* value,

Callers

nothing calls this directly

Calls 8

NumInputsFunction · 0.85
GetInputFunction · 0.85
NumDimensionsFunction · 0.85
GetOutputFunction · 0.85
TfLiteIntArrayCreateFunction · 0.85
SizeOfDimensionFunction · 0.85
ResizeTensorMethod · 0.80
NumOutputsFunction · 0.70

Tested by

no test coverage detected