Remove empty Init, Free, and Prepare functions.

The interpreter doesn't call it if a nullptr is presented in the registration. This can slightly reduce code size.

PiperOrigin-RevId: 304284594
Change-Id: I7fa092aa9cf5142ee30982d07655971fd1626630
This commit is contained in:
Robert David 2020-04-01 16:21:55 -07:00 committed by TensorFlower Gardener
parent f65682a358
commit a0422e404e
38 changed files with 196 additions and 358 deletions

View File

@ -54,16 +54,6 @@ struct OpData {
int32 output_offset; int32 output_offset;
}; };
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteAddParams* params, TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteAddParams* params,
const TfLiteTensor* input1, const TfLiteTensor* input1,
const TfLiteTensor* input2, TfLiteTensor* output, const TfLiteTensor* input2, TfLiteTensor* output,
@ -198,9 +188,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace add } // namespace add
TfLiteRegistration* Register_ADD() { TfLiteRegistration* Register_ADD() {
static TfLiteRegistration r = {/*init=*/add::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/add::Free, /*free=*/nullptr,
/*prepare=*/add::Prepare, /*prepare=*/nullptr,
/*invoke=*/add::Eval, /*invoke=*/add::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -107,16 +107,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
return kTfLiteOk; return kTfLiteOk;
} }
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalQuantized(TfLiteContext* context, TfLiteNode* node, void EvalQuantized(TfLiteContext* context, TfLiteNode* node,
TfLiteConvParams* params, OpData* data, TfLiteConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -337,8 +327,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace conv } // namespace conv
TfLiteRegistration* Register_CONV_2D() { TfLiteRegistration* Register_CONV_2D() {
static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare, static TfLiteRegistration r = {/*init=*/nullptr,
conv::Eval}; /*free=*/nullptr,
/*prepare=*/nullptr,
/*invoke=*/conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -103,16 +103,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalFloat(TfLiteContext* context, TfLiteNode* node, void EvalFloat(TfLiteContext* context, TfLiteNode* node,
TfLiteDepthwiseConvParams* params, OpData* data, TfLiteDepthwiseConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -338,8 +328,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {depthwise_conv::Init, depthwise_conv::Free, static TfLiteRegistration r = {/*init=*/nullptr,
depthwise_conv::Prepare, depthwise_conv::Eval}; /*free=*/nullptr,
/*prepare=*/nullptr,
/*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -72,16 +72,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node, TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node,
TfLiteFullyConnectedParams* params, OpData* data, TfLiteFullyConnectedParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* input,
@ -242,9 +232,15 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace fully_connected } // namespace fully_connected
TfLiteRegistration* Register_FULLY_CONNECTED() { TfLiteRegistration* Register_FULLY_CONNECTED() {
static TfLiteRegistration r = {fully_connected::Init, fully_connected::Free, static TfLiteRegistration r = {/*init=*/nullptr,
fully_connected::Prepare, /*free=*/nullptr,
fully_connected::Eval}; /*prepare=*/nullptr,
/*invoke=*/fully_connected::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -209,16 +209,6 @@ void MaxEvalQuantizedUInt8(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data); auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data);
OpData data; OpData data;
@ -274,18 +264,26 @@ TfLiteStatus MaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace pooling } // namespace pooling
TfLiteRegistration* Register_AVERAGE_POOL_2D() { TfLiteRegistration* Register_AVERAGE_POOL_2D() {
static TfLiteRegistration r = { static TfLiteRegistration r = {/*init=*/nullptr,
pooling::Init, /*free=*/nullptr,
pooling::Free, /*prepare=*/nullptr,
pooling::Prepare, /*invoke=*/pooling::AverageEval,
pooling::AverageEval, /*profiling_string=*/nullptr,
}; /*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }
TfLiteRegistration* Register_MAX_POOL_2D() { TfLiteRegistration* Register_MAX_POOL_2D() {
static TfLiteRegistration r = {pooling::Init, pooling::Free, pooling::Prepare, static TfLiteRegistration r = {/*init=*/nullptr,
pooling::MaxEval}; /*free=*/nullptr,
/*prepare=*/nullptr,
/*invoke=*/pooling::MaxEval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -30,10 +30,6 @@ constexpr int kInputTensor = 0;
constexpr int kAxis = 1; constexpr int kAxis = 1;
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3>
inline void ArgMinMaxHelper(const RuntimeShape& input1_shape, inline void ArgMinMaxHelper(const RuntimeShape& input1_shape,
const T1* input1_data, const T3* input2_data, const T1* input1_data, const T3* input2_data,
@ -105,7 +101,7 @@ TfLiteStatus ArgMaxEval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_ARG_MAX() { TfLiteRegistration* Register_ARG_MAX() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/arg_min_max::Prepare, /*prepare=*/nullptr,
/*invoke=*/arg_min_max::ArgMaxEval, /*invoke=*/arg_min_max::ArgMaxEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,
@ -117,7 +113,7 @@ TfLiteRegistration* Register_ARG_MAX() {
TfLiteRegistration* Register_ARG_MIN() { TfLiteRegistration* Register_ARG_MIN() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/arg_min_max::Prepare, /*prepare=*/nullptr,
/*invoke=*/arg_min_max::ArgMinEval, /*invoke=*/arg_min_max::ArgMinEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -115,8 +115,6 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return raw; return raw;
} }
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP) #if defined(__ARM_FEATURE_DSP)
OpData data; OpData data;
@ -408,8 +406,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace conv } // namespace conv
TfLiteRegistration* Register_CONV_2D() { TfLiteRegistration* Register_CONV_2D() {
static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare, static TfLiteRegistration r = {/*init=*/conv::Init,
conv::Eval}; /*free=*/nullptr,
/*prepare=*/conv::Prepare,
/*invoke=*/conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -103,8 +103,6 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return raw; return raw;
} }
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP) #if defined(__ARM_FEATURE_DSP)
auto* params = auto* params =
@ -391,8 +389,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {depthwise_conv::Init, depthwise_conv::Free, static TfLiteRegistration r = {/*init=*/depthwise_conv::Init,
depthwise_conv::Prepare, depthwise_conv::Eval}; /*free=*/nullptr,
/*prepare=*/depthwise_conv::Prepare,
/*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -77,8 +77,6 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return raw; return raw;
} }
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP) #if defined(__ARM_FEATURE_DSP)
const TfLiteTensor* filter = GetInput(context, node, kWeightsTensor); const TfLiteTensor* filter = GetInput(context, node, kWeightsTensor);
@ -253,9 +251,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace fully_connected } // namespace fully_connected
TfLiteRegistration* Register_FULLY_CONNECTED() { TfLiteRegistration* Register_FULLY_CONNECTED() {
static TfLiteRegistration r = {fully_connected::Init, fully_connected::Free, static TfLiteRegistration r = {/*init=*/fully_connected::Init,
fully_connected::Prepare, /*free=*/nullptr,
fully_connected::Eval}; /*prepare=*/fully_connected::Prepare,
/*invoke=*/fully_connected::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -214,8 +214,6 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return raw; return raw;
} }
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
#if defined(__ARM_FEATURE_DSP) #if defined(__ARM_FEATURE_DSP)
const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* input = GetInput(context, node, kInputTensor);
@ -302,18 +300,26 @@ TfLiteStatus MaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace pooling } // namespace pooling
TfLiteRegistration* Register_AVERAGE_POOL_2D() { TfLiteRegistration* Register_AVERAGE_POOL_2D() {
static TfLiteRegistration r = { static TfLiteRegistration r = {/*init=*/pooling::Init,
pooling::Init, /*free=*/nullptr,
pooling::Free, /*prepare=*/pooling::Prepare,
pooling::Prepare, /*invoke=*/pooling::AverageEval,
pooling::AverageEval, /*profiling_string=*/nullptr,
}; /*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }
TfLiteRegistration* Register_MAX_POOL_2D() { TfLiteRegistration* Register_MAX_POOL_2D() {
static TfLiteRegistration r = {pooling::Init, pooling::Free, pooling::Prepare, static TfLiteRegistration r = {/*init=*/pooling::Init,
pooling::MaxEval}; /*free=*/nullptr,
/*prepare=*/pooling::Prepare,
/*invoke=*/pooling::MaxEval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -62,12 +62,6 @@ TfLiteStatus CalculateSoftmaxParams(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
@ -137,9 +131,14 @@ TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace activations } // namespace activations
TfLiteRegistration* Register_SOFTMAX() { TfLiteRegistration* Register_SOFTMAX() {
static TfLiteRegistration r = {activations::Init, activations::Free, static TfLiteRegistration r = {/*init=*/nullptr,
activations::SoftmaxPrepare, /*free=*/nullptr,
activations::SoftmaxEval}; /*prepare=*/activations::SoftmaxPrepare,
/*invoke=*/activations::SoftmaxEval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -109,16 +109,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
return kTfLiteOk; return kTfLiteOk;
} }
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalQuantized(TfLiteContext* context, TfLiteNode* node, void EvalQuantized(TfLiteContext* context, TfLiteNode* node,
TfLiteConvParams* params, OpData* data, TfLiteConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -273,7 +263,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_CONV_2D() { TfLiteRegistration* Register_CONV_2D() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/conv::Prepare, /*prepare=*/nullptr,
/*invoke=*/conv::Eval, /*invoke=*/conv::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -96,16 +96,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalFloat(TfLiteContext* context, TfLiteNode* node, void EvalFloat(TfLiteContext* context, TfLiteNode* node,
TfLiteDepthwiseConvParams* params, OpData* data, TfLiteDepthwiseConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -263,9 +253,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {/*init=*/depthwise_conv::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/depthwise_conv::Free, /*free=*/nullptr,
/*prepare=*/depthwise_conv::Prepare, /*prepare=*/nullptr,
/*invoke=*/depthwise_conv::Eval, /*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -80,8 +80,6 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return data; return data;
} }
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data); OpData* data = reinterpret_cast<OpData*>(node->user_data);
auto* params = auto* params =
@ -222,7 +220,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_FULLY_CONNECTED() { TfLiteRegistration* Register_FULLY_CONNECTED() {
static TfLiteRegistration r = {/*init=*/fully_connected::Init, static TfLiteRegistration r = {/*init=*/fully_connected::Init,
/*free=*/fully_connected::Free, /*free=*/nullptr,
/*prepare=*/fully_connected::Prepare, /*prepare=*/fully_connected::Prepare,
/*invoke=*/fully_connected::Eval, /*invoke=*/fully_connected::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,

View File

@ -31,10 +31,6 @@ namespace activations {
constexpr int kInputTensor = 0; constexpr int kInputTensor = 0;
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
@ -85,7 +81,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_LOGISTIC() { TfLiteRegistration* Register_LOGISTIC() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/activations::Prepare, /*prepare=*/nullptr,
/*invoke=*/activations::Eval, /*invoke=*/activations::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -65,10 +65,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
return kTfLiteOk; return kTfLiteOk;
} }
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalQuantized(TfLiteContext* context, TfLiteNode* node, void EvalQuantized(TfLiteContext* context, TfLiteNode* node,
TfLiteMulParams* params, OpData* data, TfLiteMulParams* params, OpData* data,
const TfLiteTensor* input1, const TfLiteTensor* input2, const TfLiteTensor* input1, const TfLiteTensor* input2,
@ -165,7 +161,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_MUL() { TfLiteRegistration* Register_MUL() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/mul::Prepare, /*prepare=*/nullptr,
/*invoke=*/mul::Eval, /*invoke=*/mul::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -26,10 +26,6 @@ namespace {
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
template <typename T> template <typename T>
TfLiteStatus PackImpl(TfLiteContext* context, TfLiteNode* node, TfLiteStatus PackImpl(TfLiteContext* context, TfLiteNode* node,
TfLiteTensor* output, int values_count, int axis) { TfLiteTensor* output, int values_count, int axis) {
@ -115,7 +111,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_PACK() { TfLiteRegistration* Register_PACK() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/pack::Prepare, /*prepare=*/nullptr,
/*invoke=*/pack::Eval, /*invoke=*/pack::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -155,15 +155,6 @@ void MaxEvalQuantized(TfLiteContext* context, TfLiteNode* node,
} }
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data); auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data);
@ -219,9 +210,9 @@ TfLiteStatus MaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace pooling } // namespace pooling
TfLiteRegistration* Register_AVERAGE_POOL_2D() { TfLiteRegistration* Register_AVERAGE_POOL_2D() {
static TfLiteRegistration r = {/*init=*/pooling::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/pooling::Free, /*free=*/nullptr,
/*prepare=*/pooling::Prepare, /*prepare=*/nullptr,
/*invoke=*/pooling::AverageEval, /*invoke=*/pooling::AverageEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,
@ -231,9 +222,9 @@ TfLiteRegistration* Register_AVERAGE_POOL_2D() {
} }
TfLiteRegistration* Register_MAX_POOL_2D() { TfLiteRegistration* Register_MAX_POOL_2D() {
static TfLiteRegistration r = {/*init=*/pooling::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/pooling::Free, /*free=*/nullptr,
/*prepare=*/pooling::Prepare, /*prepare=*/nullptr,
/*invoke=*/pooling::MaxEval, /*invoke=*/pooling::MaxEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -297,16 +297,6 @@ static inline void DepthwiseConvOptimizedForFilterWidthEight(
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
void EvalFloat(TfLiteContext* context, TfLiteNode* node, void EvalFloat(TfLiteContext* context, TfLiteNode* node,
TfLiteDepthwiseConvParams* params, OpData* data, TfLiteDepthwiseConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -509,9 +499,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {/*init=*/depthwise_conv::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/depthwise_conv::Free, /*free=*/nullptr,
/*prepare=*/depthwise_conv::Prepare, /*prepare=*/nullptr,
/*invoke=*/depthwise_conv::Eval, /*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -26,12 +26,6 @@ namespace ops {
namespace micro { namespace micro {
namespace quantize { namespace quantize {
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
@ -119,8 +113,8 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
// AffineQuantize takes scale and zero point and quantizes the float value to // AffineQuantize takes scale and zero point and quantizes the float value to
// quantized output, in int8 or uint8 format. // quantized output, in int8 or uint8 format.
TfLiteRegistration* Register_QUANTIZE() { TfLiteRegistration* Register_QUANTIZE() {
static TfLiteRegistration r = {/*init=*/quantize::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/quantize::Free, /*free=*/nullptr,
/*prepare=*/quantize::Prepare, /*prepare=*/quantize::Prepare,
/*invoke=*/quantize::Eval, /*invoke=*/quantize::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,

View File

@ -72,12 +72,6 @@ TfLiteStatus CalculateSoftmaxParams(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
@ -145,14 +139,14 @@ TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace activations } // namespace activations
TfLiteRegistration* Register_SOFTMAX() { TfLiteRegistration* Register_SOFTMAX() {
static TfLiteRegistration r = {activations::Init, static TfLiteRegistration r = {/*init=*/nullptr,
activations::Free, /*free=*/nullptr,
activations::SoftmaxPrepare, /*prepare=*/activations::SoftmaxPrepare,
activations::SoftmaxEval, /*invoke=*/activations::SoftmaxEval,
nullptr, /*profiling_string=*/nullptr,
0, /*builtin_code=*/0,
nullptr, /*custom_name=*/nullptr,
0}; /*version=*/0};
return &r; return &r;
} }

View File

@ -23,10 +23,6 @@ namespace ops {
namespace micro { namespace micro {
namespace split { namespace split {
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
template <typename T> template <typename T>
TfLiteStatus SplitImpl(TfLiteContext* context, TfLiteNode* node, TfLiteStatus SplitImpl(TfLiteContext* context, TfLiteNode* node,
const TfLiteTensor* input, int axis_value) { const TfLiteTensor* input, int axis_value) {
@ -118,7 +114,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_SPLIT() { TfLiteRegistration* Register_SPLIT() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/split::Prepare, /*prepare=*/nullptr,
/*invoke=*/split::Eval, /*invoke=*/split::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -54,16 +54,6 @@ struct OpData {
int32 output_offset; int32 output_offset;
}; };
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteSubParams* params, TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteSubParams* params,
const TfLiteTensor* input1, const TfLiteTensor* input1,
const TfLiteTensor* input2, TfLiteTensor* output, const TfLiteTensor* input2, TfLiteTensor* output,
@ -195,9 +185,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace sub } // namespace sub
TfLiteRegistration* Register_SUB() { TfLiteRegistration* Register_SUB() {
static TfLiteRegistration r = {/*init=*/sub::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/sub::Free, /*free=*/nullptr,
/*prepare=*/sub::Prepare, /*prepare=*/nullptr,
/*invoke=*/sub::Eval, /*invoke=*/sub::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -331,12 +331,6 @@ constexpr int kInputActivationStateTensor = 4;
// Output tensor. // Output tensor.
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data); const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data);
@ -529,8 +523,8 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace svdf } // namespace svdf
TfLiteRegistration* Register_SVDF() { TfLiteRegistration* Register_SVDF() {
static TfLiteRegistration r = {/*init=*/svdf::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/svdf::Free, /*free=*/nullptr,
/*prepare=*/svdf::Prepare, /*prepare=*/svdf::Prepare,
/*invoke=*/svdf::Eval, /*invoke=*/svdf::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,

View File

@ -26,10 +26,6 @@ namespace {
constexpr int kInputTensor = 0; constexpr int kInputTensor = 0;
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
template <typename T> template <typename T>
TfLiteStatus UnpackImpl(TfLiteContext* context, TfLiteNode* node, TfLiteStatus UnpackImpl(TfLiteContext* context, TfLiteNode* node,
const TfLiteTensor* input, int output_count, int axis) { const TfLiteTensor* input, int output_count, int axis) {
@ -108,7 +104,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_UNPACK() { TfLiteRegistration* Register_UNPACK() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/unpack::Prepare, /*prepare=*/nullptr,
/*invoke=*/unpack::Eval, /*invoke=*/unpack::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -131,16 +131,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
return kTfLiteOk; return kTfLiteOk;
} }
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus EvalQuantized(TfLiteContext* context, TfLiteNode* node, TfLiteStatus EvalQuantized(TfLiteContext* context, TfLiteNode* node,
TfLiteConvParams* params, OpData* data, TfLiteConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* input,
@ -540,7 +530,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_CONV_2D() { TfLiteRegistration* Register_CONV_2D() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/conv::Prepare, /*prepare=*/nullptr,
/*invoke=*/conv::Eval, /*invoke=*/conv::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -118,16 +118,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus EvalFloat(TfLiteContext* context, TfLiteNode* node, TfLiteStatus EvalFloat(TfLiteContext* context, TfLiteNode* node,
TfLiteDepthwiseConvParams* params, OpData* data, TfLiteDepthwiseConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* input, const TfLiteTensor* filter,
@ -547,9 +537,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {/*init=*/depthwise_conv::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/depthwise_conv::Free, /*free=*/nullptr,
/*prepare=*/depthwise_conv::Prepare, /*prepare=*/nullptr,
/*invoke=*/depthwise_conv::Eval, /*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -92,16 +92,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node, TfLiteStatus EvalQuantizedInt8(TfLiteContext* context, TfLiteNode* node,
TfLiteFullyConnectedParams* params, OpData* data, TfLiteFullyConnectedParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* input,
@ -264,9 +254,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace fully_connected } // namespace fully_connected
TfLiteRegistration* Register_FULLY_CONNECTED() { TfLiteRegistration* Register_FULLY_CONNECTED() {
static TfLiteRegistration r = {/*init=*/fully_connected::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/fully_connected::Free, /*free=*/nullptr,
/*prepare=*/fully_connected::Prepare, /*prepare=*/nullptr,
/*invoke=*/fully_connected::Eval, /*invoke=*/fully_connected::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -53,10 +53,6 @@ namespace activations {
constexpr int kInputTensor = 0; constexpr int kInputTensor = 0;
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
@ -117,7 +113,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteRegistration* Register_LOGISTIC() { TfLiteRegistration* Register_LOGISTIC() {
static TfLiteRegistration r = {/*init=*/nullptr, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/nullptr, /*free=*/nullptr,
/*prepare=*/activations::Prepare, /*prepare=*/nullptr,
/*invoke=*/activations::Eval, /*invoke=*/activations::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -494,15 +494,6 @@ TfLiteStatus MaxEvalQuantized(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus AverageEval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data); auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data);
@ -558,9 +549,9 @@ TfLiteStatus MaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace pooling } // namespace pooling
TfLiteRegistration* Register_AVERAGE_POOL_2D() { TfLiteRegistration* Register_AVERAGE_POOL_2D() {
static TfLiteRegistration r = {/*init=*/pooling::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/pooling::Free, /*free=*/nullptr,
/*prepare=*/pooling::Prepare, /*prepare=*/nullptr,
/*invoke=*/pooling::AverageEval, /*invoke=*/pooling::AverageEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,
@ -570,9 +561,9 @@ TfLiteRegistration* Register_AVERAGE_POOL_2D() {
} }
TfLiteRegistration* Register_MAX_POOL_2D() { TfLiteRegistration* Register_MAX_POOL_2D() {
static TfLiteRegistration r = {/*init=*/pooling::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/pooling::Free, /*free=*/nullptr,
/*prepare=*/pooling::Prepare, /*prepare=*/nullptr,
/*invoke=*/pooling::MaxEval, /*invoke=*/pooling::MaxEval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,

View File

@ -93,12 +93,6 @@ TfLiteStatus CalculateSoftmaxParams(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
@ -214,14 +208,14 @@ TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace activations } // namespace activations
TfLiteRegistration* Register_SOFTMAX() { TfLiteRegistration* Register_SOFTMAX() {
static TfLiteRegistration r = {activations::Init, static TfLiteRegistration r = {/*init=*/nullptr,
activations::Free, /*free=*/nullptr,
activations::SoftmaxPrepare, /*prepare=*/activations::SoftmaxPrepare,
activations::SoftmaxEval, /*invoke=*/activations::SoftmaxEval,
nullptr, /*profiling_string=*/nullptr,
0, /*builtin_code=*/0,
nullptr, /*custom_name=*/nullptr,
0}; /*version=*/0};
return &r; return &r;
} }

View File

@ -361,12 +361,6 @@ constexpr int kInputActivationStateTensor = 4;
// Output tensor. // Output tensor.
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data); const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data);
@ -566,14 +560,15 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace svdf } // namespace svdf
TfLiteRegistration* Register_SVDF() { TfLiteRegistration* Register_SVDF() {
static TfLiteRegistration r = {/*init=*/svdf::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/svdf::Free, /*free=*/nullptr,
/*prepare=*/svdf::Prepare, /*prepare=*/svdf::Prepare,
/*invoke=*/svdf::Eval, /*invoke=*/svdf::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,
/*builtin_code=*/0, /*builtin_code=*/0,
/*custom_name=*/nullptr, /*custom_name=*/nullptr,
/*version=*/0}; /*version=*/0};
return &r; return &r;
} }

View File

@ -247,12 +247,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
return kTfLiteOk; return kTfLiteOk;
} }
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data); auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data);
@ -352,8 +346,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace conv } // namespace conv
TfLiteRegistration* Register_CONV_2D() { TfLiteRegistration* Register_CONV_2D() {
static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare, static TfLiteRegistration r = {/*init=*/nullptr,
conv::Eval}; /*free=*/nullptr,
/*prepare=*/conv::Prepare,
/*invoke=*/conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -249,12 +249,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* params = auto* params =
reinterpret_cast<TfLiteDepthwiseConvParams*>(node->builtin_data); reinterpret_cast<TfLiteDepthwiseConvParams*>(node->builtin_data);
@ -360,8 +354,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace depthwise_conv } // namespace depthwise_conv
TfLiteRegistration* Register_DEPTHWISE_CONV_2D() { TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {
static TfLiteRegistration r = {depthwise_conv::Init, depthwise_conv::Free, static TfLiteRegistration r = {/*init=*/nullptr,
depthwise_conv::Prepare, depthwise_conv::Eval}; /*free=*/nullptr,
/*prepare=*/depthwise_conv::Prepare,
/*invoke=*/depthwise_conv::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -175,12 +175,6 @@ TfLiteStatus CalculateOpData(TfLiteContext* context,
} // namespace } // namespace
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* params = auto* params =
reinterpret_cast<TfLiteFullyConnectedParams*>(node->builtin_data); reinterpret_cast<TfLiteFullyConnectedParams*>(node->builtin_data);
@ -251,9 +245,15 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace fully_connected } // namespace fully_connected
TfLiteRegistration* Register_FULLY_CONNECTED() { TfLiteRegistration* Register_FULLY_CONNECTED() {
static TfLiteRegistration r = {fully_connected::Init, fully_connected::Free, static TfLiteRegistration r = {/*init=*/nullptr,
fully_connected::Prepare, /*free=*/nullptr,
fully_connected::Eval}; /*prepare=*/fully_connected::Prepare,
/*invoke=*/fully_connected::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -118,12 +118,6 @@ constexpr int kMaxOpDataSize = 2;
static int kStaticOpDataCounter = 0; static int kStaticOpDataCounter = 0;
static OpData kStaticOpData[kMaxOpDataSize]; static OpData kStaticOpData[kMaxOpDataSize];
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TfLiteTensor* output = GetOutput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0);
const TfLiteTensor* input = GetInput(context, node, 0); const TfLiteTensor* input = GetInput(context, node, 0);
@ -168,8 +162,8 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
// AffineQuantize takes scale and zero point and quantizes the float value to // AffineQuantize takes scale and zero point and quantizes the float value to
// quantized output, in int8 or uint8 format. // quantized output, in int8 or uint8 format.
TfLiteRegistration* Register_QUANTIZE() { TfLiteRegistration* Register_QUANTIZE() {
static TfLiteRegistration r = {/*init=*/quantize::Init, static TfLiteRegistration r = {/*init=*/nullptr,
/*free=*/quantize::Free, /*free=*/nullptr,
/*prepare=*/quantize::Prepare, /*prepare=*/quantize::Prepare,
/*invoke=*/quantize::Eval, /*invoke=*/quantize::Eval,
/*profiling_string=*/nullptr, /*profiling_string=*/nullptr,

View File

@ -169,12 +169,6 @@ void SoftmaxQuantized(const TfLiteTensor* input, TfLiteTensor* output,
} }
} }
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus SoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
auto* params = static_cast<TfLiteSoftmaxParams*>(node->builtin_data); auto* params = static_cast<TfLiteSoftmaxParams*>(node->builtin_data);
@ -216,9 +210,14 @@ TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
} // namespace activations } // namespace activations
TfLiteRegistration* Register_SOFTMAX() { TfLiteRegistration* Register_SOFTMAX() {
static TfLiteRegistration r = {activations::Init, activations::Free, static TfLiteRegistration r = {/*init=*/nullptr,
activations::SoftmaxPrepare, /*free=*/nullptr,
activations::SoftmaxEval}; /*prepare=*/activations::SoftmaxPrepare,
/*invoke=*/activations::SoftmaxEval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }

View File

@ -258,12 +258,6 @@ constexpr int kInputActivationStateTensor = 4;
// Output tensor. // Output tensor.
constexpr int kOutputTensor = 0; constexpr int kOutputTensor = 0;
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
return nullptr;
}
void Free(TfLiteContext* context, void* buffer) {}
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data); const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data);
@ -409,8 +403,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
} // namespace svdf } // namespace svdf
TfLiteRegistration* Register_SVDF() { TfLiteRegistration* Register_SVDF() {
static TfLiteRegistration r = {svdf::Init, svdf::Free, svdf::Prepare, static TfLiteRegistration r = {/*init=*/nullptr,
svdf::Eval}; /*free=*/nullptr,
/*prepare=*/svdf::Prepare,
/*invoke=*/svdf::Eval,
/*profiling_string=*/nullptr,
/*builtin_code=*/0,
/*custom_name=*/nullptr,
/*version=*/0};
return &r; return &r;
} }