Merge pull request #46239 from rsun-bdti:issue-45196-pr1
PiperOrigin-RevId: 351899420 Change-Id: Ia056ed8d39ede256dc8045d594173b3aa87c957b
This commit is contained in:
commit
08d6a26260
@ -614,15 +614,7 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case BuiltinOperator_GATHER: {
|
case BuiltinOperator_GATHER: {
|
||||||
auto params = safe_allocator.Allocate<TfLiteGatherParams>();
|
return ParseGather(op, error_reporter, allocator, builtin_data);
|
||||||
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
|
||||||
params->axis = 0;
|
|
||||||
if (const auto* gather_params = op->builtin_options_as_GatherOptions()) {
|
|
||||||
params->axis = gather_params->axis();
|
|
||||||
}
|
|
||||||
|
|
||||||
*builtin_data = params.release();
|
|
||||||
return kTfLiteOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case BuiltinOperator_SQUEEZE: {
|
case BuiltinOperator_SQUEEZE: {
|
||||||
@ -1245,6 +1237,25 @@ TfLiteStatus ParseFullyConnected(const Operator* op,
|
|||||||
return kTfLiteOk;
|
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 ParseGather(const Operator* op, ErrorReporter* error_reporter,
|
||||||
|
BuiltinDataAllocator* allocator, void** builtin_data) {
|
||||||
|
CheckParsePointerParams(op, error_reporter, allocator, builtin_data);
|
||||||
|
|
||||||
|
SafeBuiltinDataAllocator safe_allocator(allocator);
|
||||||
|
auto params = safe_allocator.Allocate<TfLiteGatherParams>();
|
||||||
|
TF_LITE_ENSURE(error_reporter, params != nullptr);
|
||||||
|
params->axis = 0;
|
||||||
|
if (const auto* gather_params = op->builtin_options_as_GatherOptions()) {
|
||||||
|
params->axis = gather_params->axis();
|
||||||
|
}
|
||||||
|
|
||||||
|
*builtin_data = params.release();
|
||||||
|
return kTfLiteOk;
|
||||||
|
}
|
||||||
|
|
||||||
// We have this parse function instead of directly returning kTfLiteOk from the
|
// 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
|
// switch-case in ParseOpData because this function is used as part of the
|
||||||
// selective registration for the OpResolver implementation in micro.
|
// selective registration for the OpResolver implementation in micro.
|
||||||
|
@ -143,6 +143,9 @@ TfLiteStatus ParseFullyConnected(const Operator* op,
|
|||||||
BuiltinDataAllocator* allocator,
|
BuiltinDataAllocator* allocator,
|
||||||
void** builtin_data);
|
void** builtin_data);
|
||||||
|
|
||||||
|
TfLiteStatus ParseGather(const Operator* op, ErrorReporter* error_reporter,
|
||||||
|
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||||
|
|
||||||
TfLiteStatus ParseGreater(const Operator* op, ErrorReporter* error_reporter,
|
TfLiteStatus ParseGreater(const Operator* op, ErrorReporter* error_reporter,
|
||||||
BuiltinDataAllocator* allocator, void** builtin_data);
|
BuiltinDataAllocator* allocator, void** builtin_data);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user