File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ TFModelEvaluatorImpl::TFModelEvaluatorImpl(
121
121
tflite::InterpreterBuilder Builder (*Model, Resolver);
122
122
Builder (&Interpreter);
123
123
124
+ if (!Interpreter) {
125
+ invalidate ();
126
+ return ;
127
+ }
128
+
124
129
// We assume the input buffers are valid for the lifetime of the interpreter.
125
130
// By default, tflite allocates memory in an arena and will periodically take
126
131
// away memory and reallocate it in a different location after evaluations in
@@ -130,8 +135,7 @@ TFModelEvaluatorImpl::TFModelEvaluatorImpl(
130
135
Interpreter->tensor (I)->allocation_type =
131
136
TfLiteAllocationType::kTfLiteArenaRwPersistent ;
132
137
133
- if (!Interpreter ||
134
- Interpreter->AllocateTensors () != TfLiteStatus::kTfLiteOk ) {
138
+ if (Interpreter->AllocateTensors () != TfLiteStatus::kTfLiteOk ) {
135
139
invalidate ();
136
140
return ;
137
141
}
You can’t perform that action at this time.
0 commit comments