File tree 3 files changed +4
-7
lines changed
3 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ struct TensorData {
88
88
class SingleOpResolver : public OpResolver {
89
89
public:
90
90
SingleOpResolver (const BuiltinOperator op, TfLiteRegistration* registration)
91
- : op_(op), registration_(registration) {}
91
+ : op_(op), registration_(registration) {
92
+ registration_->builtin_code = op;
93
+ }
92
94
TfLiteRegistration* FindOp (BuiltinOperator op) const override {
93
95
if (op == op_) {
94
96
return registration_;
Original file line number Diff line number Diff line change @@ -191,7 +191,6 @@ TfLiteStatus InterpreterBuilder::BuildLocalIndexToRegistrationMapping() {
191
191
builtin_code);
192
192
status = kTfLiteError ;
193
193
} else if (builtin_code != BuiltinOperator_CUSTOM) {
194
- flatbuffer_op_index_to_registration_types_.push_back (builtin_code);
195
194
registration = op_resolver_.FindOp (builtin_code);
196
195
if (registration == nullptr ) {
197
196
error_reporter_->Report (" Didn't find op for builtin opcode '%s'\n " ,
@@ -205,8 +204,6 @@ TfLiteStatus InterpreterBuilder::BuildLocalIndexToRegistrationMapping() {
205
204
} else {
206
205
const char * name = opcode->custom_code ()->c_str ();
207
206
registration = op_resolver_.FindOp (name);
208
- flatbuffer_op_index_to_registration_types_.push_back (
209
- BuiltinOperator_CUSTOM);
210
207
if (registration == nullptr ) {
211
208
error_reporter_->Report (" Didn't find custom op for name '%s'\n " , name);
212
209
status = kTfLiteError ;
@@ -685,8 +682,7 @@ TfLiteStatus InterpreterBuilder::ParseNodes(
685
682
continue ;
686
683
}
687
684
688
- auto op_type =
689
- flatbuffer_op_index_to_registration_types_[op->opcode_index ()];
685
+ BuiltinOperator op_type = static_cast <BuiltinOperator>(reg->builtin_code );
690
686
if (op_type != BuiltinOperator_CUSTOM && op->custom_options ()) {
691
687
error_reporter_->Report (
692
688
" Found builtin operator %s with custom options.\n " ,
Original file line number Diff line number Diff line change @@ -188,7 +188,6 @@ class InterpreterBuilder {
188
188
ErrorReporter* error_reporter_;
189
189
190
190
std::vector<TfLiteRegistration*> flatbuffer_op_index_to_registration_;
191
- std::vector<BuiltinOperator> flatbuffer_op_index_to_registration_types_;
192
191
const Allocation* allocation_ = nullptr ;
193
192
};
194
193
You can’t perform that action at this time.
0 commit comments