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

Function Eval

tensorflow/lite/kernels/reverse.cc:67–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
68 const TfLiteTensor* input = GetInput(context, node, kInputTensor);
69 const TfLiteTensor* axis_tensor = GetInput(context, node, kAxisTensor);
70 int axis = GetTensorData<int32_t>(axis_tensor)[0];
71
72 TF_LITE_ENSURE(context, axis >= 0 && axis < NumDimensions(input));
73 TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
74
75 switch (output->type) {
76 case kTfLiteFloat32: {
77 reference_ops::Reverse<float>(
78 axis, GetTensorShape(input), GetTensorData<float>(input),
79 GetTensorShape(output), GetTensorData<float>(output));
80 break;
81 }
82 case kTfLiteUInt8: {
83 reference_ops::Reverse<uint8_t>(
84 axis, GetTensorShape(input), GetTensorData<uint8_t>(input),
85 GetTensorShape(output), GetTensorData<uint8_t>(output));
86 break;
87 }
88 case kTfLiteInt16: {
89 reference_ops::Reverse<int16_t>(
90 axis, GetTensorShape(input), GetTensorData<int16_t>(input),
91 GetTensorShape(output), GetTensorData<int16_t>(output));
92 break;
93 }
94 case kTfLiteInt32: {
95 reference_ops::Reverse<int32_t>(
96 axis, GetTensorShape(input), GetTensorData<int32_t>(input),
97 GetTensorShape(output), GetTensorData<int32_t>(output));
98 break;
99 }
100 case kTfLiteInt64: {
101 reference_ops::Reverse<int64_t>(
102 axis, GetTensorShape(input), GetTensorData<int64_t>(input),
103 GetTensorShape(output), GetTensorData<int64_t>(output));
104 break;
105 }
106 default: {
107 context->ReportError(context, "Type '%s' is not supported by reverse.",
108 TfLiteTypeGetName(output->type));
109 return kTfLiteError;
110 }
111 }
112
113 return kTfLiteOk;
114}
115
116} // namespace
117} // namespace reverse

Callers

nothing calls this directly

Calls 6

GetInputFunction · 0.85
NumDimensionsFunction · 0.85
GetOutputFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
GetTensorShapeFunction · 0.50
ReportErrorMethod · 0.45

Tested by

no test coverage detected