Separate out parse functionality into helper functions.
Non trivial parse function: * Mean Stub parse function: * HardSwish * Minimum * Neg * NotEqual * Pad * PadV2 * Prelu * Relu * Relu6 * Round * Rsqrt * Sin * Sqrt * Square * Tanh PiperOrigin-RevId: 318599351 Change-Id: I7dd72ae56611efd57d5b47dce844f2bcdb345766
This commit is contained in:
parent
ff28621f73
commit
b928c4c5ec
@ -461,6 +461,14 @@ TfLiteStatus ParseGreaterEqual(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseHardSwish(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParseL2Normalization(const Operator* op, BuiltinOperator,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
@ -552,6 +560,46 @@ TfLiteStatus ParseMaximum(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseMinimum(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseNeg(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseNotEqual(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParsePad(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParsePadV2(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParsePool(const Operator* op, BuiltinOperator,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data) {
|
||||
@ -583,6 +631,65 @@ TfLiteStatus ParsePool(const Operator* op, BuiltinOperator,
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParsePrelu(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseQuantize(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParseReducer(const Operator* op, BuiltinOperator,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
void** builtin_data) {
|
||||
CheckParsePointerParams(op, error_reporter, allocator, builtin_data);
|
||||
|
||||
SafeBuiltinDataAllocator safe_allocator(allocator);
|
||||
|
||||
std::unique_ptr<TfLiteReducerParams,
|
||||
SafeBuiltinDataAllocator::BuiltinDataDeleter>
|
||||
params = safe_allocator.Allocate<TfLiteReducerParams>();
|
||||
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
||||
|
||||
const ReducerOptions* schema_params = op->builtin_options_as_ReducerOptions();
|
||||
|
||||
if (schema_params != nullptr) {
|
||||
params->keep_dims = schema_params->keep_dims();
|
||||
} else {
|
||||
// TODO(b/157480169): We should either return kTfLiteError or fill in some
|
||||
// reasonable defaults in the params struct. We are not doing so until we
|
||||
// better undertand the ramifications of changing the legacy behavior.
|
||||
}
|
||||
|
||||
*builtin_data = params.release();
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseRelu(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseRelu6(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParseReshape(const Operator* op, BuiltinOperator,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
@ -627,7 +734,23 @@ TfLiteStatus ParseReshape(const Operator* op, BuiltinOperator,
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseQuantize(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
TfLiteStatus ParseRound(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseRsqrt(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseSin(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
@ -658,6 +781,22 @@ TfLiteStatus ParseSoftmax(const Operator* op, BuiltinOperator,
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseSqrt(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseSquare(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParseSvdf(const Operator* op, BuiltinOperator,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data) {
|
||||
@ -686,6 +825,14 @@ TfLiteStatus ParseSvdf(const Operator* op, BuiltinOperator,
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
||||
// switch-case in ParseOpData because this function is used as part of the
|
||||
// selective registration for the OpResolver implementation in micro.
|
||||
TfLiteStatus ParseTanh(const Operator*, BuiltinOperator, ErrorReporter*,
|
||||
BuiltinDataAllocator*, void**) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data) {
|
||||
@ -775,6 +922,11 @@ TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
|
||||
builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_HARD_SWISH: {
|
||||
return ParseHardSwish(op, op_type, error_reporter, allocator,
|
||||
builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_L2_NORMALIZATION: {
|
||||
return ParseL2Normalization(op, op_type, error_reporter, allocator,
|
||||
builtin_data);
|
||||
@ -825,23 +977,98 @@ TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
|
||||
return ParsePool(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_MEAN: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_MINIMUM: {
|
||||
return ParseMinimum(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
case BuiltinOperator_NEG: {
|
||||
return ParseNeg(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
case BuiltinOperator_NOT_EQUAL: {
|
||||
return ParseNotEqual(op, op_type, error_reporter, allocator,
|
||||
builtin_data);
|
||||
}
|
||||
case BuiltinOperator_PAD: {
|
||||
return ParsePad(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
case BuiltinOperator_PADV2: {
|
||||
return ParsePadV2(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
case BuiltinOperator_PRELU: {
|
||||
return ParsePrelu(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
case BuiltinOperator_QUANTIZE: {
|
||||
return ParseQuantize(op, op_type, error_reporter, allocator,
|
||||
builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_REDUCE_ANY: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_REDUCE_MAX: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_REDUCE_MIN: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_REDUCE_PROD: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_RELU: {
|
||||
return ParseRelu(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_RELU6: {
|
||||
return ParseRelu6(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_RESHAPE: {
|
||||
return ParseReshape(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_ROUND: {
|
||||
return ParseRound(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_RSQRT: {
|
||||
return ParseRsqrt(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SIN: {
|
||||
return ParseSin(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SOFTMAX: {
|
||||
return ParseSoftmax(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SQRT: {
|
||||
return ParseSqrt(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SQUARE: {
|
||||
return ParseSquare(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SUM: {
|
||||
return ParseReducer(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_SVDF: {
|
||||
return ParseSvdf(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_TANH: {
|
||||
return ParseTanh(op, op_type, error_reporter, allocator, builtin_data);
|
||||
}
|
||||
|
||||
case BuiltinOperator_CAST: {
|
||||
auto params = safe_allocator.Allocate<TfLiteCastParams>();
|
||||
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
||||
@ -1106,20 +1333,6 @@ TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
|
||||
*builtin_data = params.release();
|
||||
return kTfLiteOk;
|
||||
}
|
||||
case BuiltinOperator_MEAN:
|
||||
case BuiltinOperator_REDUCE_MAX:
|
||||
case BuiltinOperator_REDUCE_MIN:
|
||||
case BuiltinOperator_REDUCE_PROD:
|
||||
case BuiltinOperator_REDUCE_ANY:
|
||||
case BuiltinOperator_SUM: {
|
||||
auto params = safe_allocator.Allocate<TfLiteReducerParams>();
|
||||
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
||||
if (const auto* schema_params = op->builtin_options_as_ReducerOptions()) {
|
||||
params->keep_dims = schema_params->keep_dims();
|
||||
}
|
||||
*builtin_data = params.release();
|
||||
return kTfLiteOk;
|
||||
}
|
||||
case BuiltinOperator_SPLIT: {
|
||||
auto params = safe_allocator.Allocate<TfLiteSplitParams>();
|
||||
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
||||
@ -1336,34 +1549,19 @@ TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
|
||||
case BuiltinOperator_EQUAL:
|
||||
case BuiltinOperator_EXP:
|
||||
case BuiltinOperator_EXPAND_DIMS:
|
||||
case BuiltinOperator_HARD_SWISH:
|
||||
case BuiltinOperator_LOG_SOFTMAX:
|
||||
case BuiltinOperator_MATRIX_DIAG:
|
||||
case BuiltinOperator_MATRIX_SET_DIAG:
|
||||
case BuiltinOperator_MINIMUM:
|
||||
case BuiltinOperator_NEG:
|
||||
case BuiltinOperator_NOT_EQUAL:
|
||||
case BuiltinOperator_PAD:
|
||||
case BuiltinOperator_PADV2:
|
||||
case BuiltinOperator_PRELU:
|
||||
case BuiltinOperator_RELU:
|
||||
case BuiltinOperator_RELU6:
|
||||
case BuiltinOperator_RELU_N1_TO_1:
|
||||
case BuiltinOperator_ROUND:
|
||||
case BuiltinOperator_RSQRT:
|
||||
case BuiltinOperator_SELECT:
|
||||
case BuiltinOperator_SELECT_V2:
|
||||
case BuiltinOperator_SIN:
|
||||
case BuiltinOperator_SLICE:
|
||||
case BuiltinOperator_SPACE_TO_BATCH_ND:
|
||||
case BuiltinOperator_SQRT:
|
||||
case BuiltinOperator_TANH:
|
||||
case BuiltinOperator_TILE:
|
||||
case BuiltinOperator_TOPK_V2:
|
||||
case BuiltinOperator_TRANSPOSE:
|
||||
case BuiltinOperator_POW:
|
||||
case BuiltinOperator_FLOOR_DIV:
|
||||
case BuiltinOperator_SQUARE:
|
||||
case BuiltinOperator_ZEROS_LIKE:
|
||||
case BuiltinOperator_FILL:
|
||||
case BuiltinOperator_FLOOR_MOD:
|
||||
|
@ -140,6 +140,11 @@ TfLiteStatus ParseGreaterEqual(const Operator* op, BuiltinOperator op_type,
|
||||
BuiltinDataAllocator* allocator,
|
||||
void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseHardSwish(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseL2Normalization(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
@ -182,27 +187,88 @@ TfLiteStatus ParseMaximum(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseMinimum(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseNeg(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseNotEqual(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
void** builtin_data);
|
||||
|
||||
TfLiteStatus ParsePad(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParsePadV2(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParsePool(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParsePrelu(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseQuantize(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator,
|
||||
void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseReducer(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseRelu(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseRelu6(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseReshape(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseRound(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseRsqrt(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseSin(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseSoftmax(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseSqrt(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseSquare(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseSvdf(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
TfLiteStatus ParseTanh(const Operator* op, BuiltinOperator op_type,
|
||||
ErrorReporter* error_reporter,
|
||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||
|
||||
} // namespace tflite
|
||||
|
||||
#endif // TENSORFLOW_LITE_CORE_API_FLATBUFFER_CONVERSIONS_H_
|
||||
|
@ -194,10 +194,9 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddHardSwish() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_HARD_SWISH,
|
||||
*tflite::ops::micro::Register_HARD_SWISH(), ParseOpData);
|
||||
*tflite::ops::micro::Register_HARD_SWISH(),
|
||||
ParseHardSwish);
|
||||
}
|
||||
|
||||
TfLiteStatus AddL2Normalization() {
|
||||
@ -256,17 +255,13 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddMean() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_MEAN,
|
||||
*tflite::ops::micro::Register_MEAN(), ParseOpData);
|
||||
*tflite::ops::micro::Register_MEAN(), ParseReducer);
|
||||
}
|
||||
|
||||
TfLiteStatus AddMinimum() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_MINIMUM,
|
||||
*tflite::ops::micro::Register_MINIMUM(), ParseOpData);
|
||||
*tflite::ops::micro::Register_MINIMUM(), ParseMinimum);
|
||||
}
|
||||
|
||||
TfLiteStatus AddMul() {
|
||||
@ -277,17 +272,13 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddNeg() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_NEG, *tflite::ops::micro::Register_NEG(),
|
||||
ParseOpData);
|
||||
ParseNeg);
|
||||
}
|
||||
|
||||
TfLiteStatus AddNotEqual() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_NOT_EQUAL,
|
||||
*tflite::ops::micro::Register_NOT_EQUAL(), ParseOpData);
|
||||
*tflite::ops::micro::Register_NOT_EQUAL(), ParseNotEqual);
|
||||
}
|
||||
|
||||
TfLiteStatus AddPack() {
|
||||
@ -298,24 +289,18 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddPad() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_PAD, *tflite::ops::micro::Register_PAD(),
|
||||
ParseOpData);
|
||||
ParsePad);
|
||||
}
|
||||
|
||||
TfLiteStatus AddPadV2() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_PADV2,
|
||||
*tflite::ops::micro::Register_PADV2(), ParseOpData);
|
||||
*tflite::ops::micro::Register_PADV2(), ParsePadV2);
|
||||
}
|
||||
|
||||
TfLiteStatus AddPrelu() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_PRELU,
|
||||
*tflite::ops::micro::Register_PRELU(), ParseOpData);
|
||||
*tflite::ops::micro::Register_PRELU(), ParsePrelu);
|
||||
}
|
||||
|
||||
TfLiteStatus AddQuantize() {
|
||||
@ -324,17 +309,13 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddRelu() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_RELU,
|
||||
*tflite::ops::micro::Register_RELU(), ParseOpData);
|
||||
*tflite::ops::micro::Register_RELU(), ParseRelu);
|
||||
}
|
||||
|
||||
TfLiteStatus AddRelu6() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_RELU6,
|
||||
*tflite::ops::micro::Register_RELU6(), ParseOpData);
|
||||
*tflite::ops::micro::Register_RELU6(), ParseRelu6);
|
||||
}
|
||||
|
||||
TfLiteStatus AddReshape() {
|
||||
@ -351,24 +332,18 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddRound() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_ROUND,
|
||||
*tflite::ops::micro::Register_ROUND(), ParseOpData);
|
||||
*tflite::ops::micro::Register_ROUND(), ParseRound);
|
||||
}
|
||||
|
||||
TfLiteStatus AddRsqrt() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_RSQRT,
|
||||
*tflite::ops::micro::Register_RSQRT(), ParseOpData);
|
||||
*tflite::ops::micro::Register_RSQRT(), ParseRsqrt);
|
||||
}
|
||||
|
||||
TfLiteStatus AddSin() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_SIN, *tflite::ops::micro::Register_SIN(),
|
||||
ParseOpData);
|
||||
ParseSin);
|
||||
}
|
||||
|
||||
TfLiteStatus AddSoftmax() {
|
||||
@ -384,17 +359,13 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddSqrt() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_SQRT,
|
||||
*tflite::ops::micro::Register_SQRT(), ParseOpData);
|
||||
*tflite::ops::micro::Register_SQRT(), ParseSqrt);
|
||||
}
|
||||
|
||||
TfLiteStatus AddSquare() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_SQUARE,
|
||||
*tflite::ops::micro::Register_SQUARE(), ParseOpData);
|
||||
*tflite::ops::micro::Register_SQUARE(), ParseSquare);
|
||||
}
|
||||
|
||||
TfLiteStatus AddStridedSlice() {
|
||||
@ -418,10 +389,8 @@ class MicroMutableOpResolver : public MicroOpResolver {
|
||||
}
|
||||
|
||||
TfLiteStatus AddTanh() {
|
||||
// TODO(b/149408647): Replace ParseOpData with the operator specific parse
|
||||
// function.
|
||||
return AddBuiltin(BuiltinOperator_TANH,
|
||||
*tflite::ops::micro::Register_TANH(), ParseOpData);
|
||||
*tflite::ops::micro::Register_TANH(), ParseTanh);
|
||||
}
|
||||
|
||||
TfLiteStatus AddUnpack() {
|
||||
|
Loading…
Reference in New Issue
Block a user