aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/model.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/lite/model.cc')
-rw-r--r--tensorflow/contrib/lite/model.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/tensorflow/contrib/lite/model.cc b/tensorflow/contrib/lite/model.cc
index 6311d60b91..d50c345194 100644
--- a/tensorflow/contrib/lite/model.cc
+++ b/tensorflow/contrib/lite/model.cc
@@ -27,8 +27,8 @@ limitations under the License.
#ifndef TFLITE_MCU
#include "tensorflow/contrib/lite/nnapi_delegate.h"
#endif
-#if defined(TFLITE_EXTENDED)
-#include "tensorflow/contrib/lite/delegates/eager/delegate.h"
+#if defined(TFLITE_FLEX)
+#include "tensorflow/contrib/lite/delegates/flex/delegate.h"
#endif
#include "tensorflow/contrib/lite/version.h"
@@ -189,6 +189,13 @@ std::vector<int> FlatBufferIntArrayToVector(T* flat_array) {
return ret;
}
+// Used to determine how the op data parsing function creates its working space.
+class MallocDataAllocator : public BuiltinDataAllocator {
+ public:
+ void* Allocate(size_t size) override { return malloc(size); }
+ void Deallocate(void* data) override { free(data); }
+};
+
} // namespace
TfLiteStatus InterpreterBuilder::ParseNodes(
@@ -234,8 +241,9 @@ TfLiteStatus InterpreterBuilder::ParseNodes(
op->custom_options()->size(), nullptr, registration);
} else {
void* builtin_data = nullptr;
- TF_LITE_ENSURE_STATUS(
- ParseOpData(op, op_type, error_reporter_, &builtin_data));
+ MallocDataAllocator malloc_allocator;
+ TF_LITE_ENSURE_STATUS(ParseOpData(op, op_type, error_reporter_,
+ &malloc_allocator, &builtin_data));
interpreter->AddNodeWithParameters(
FlatBufferIntArrayToVector(op->inputs()),
FlatBufferIntArrayToVector(op->outputs()), nullptr, 0, builtin_data,
@@ -442,8 +450,8 @@ TfLiteStatus InterpreterBuilder::operator()(
}
(**interpreter).SetVariables(std::move(variables));
-#if defined(TFLITE_EXTENDED)
- if (auto delegate = EagerDelegate::Create()) {
+#if defined(TFLITE_FLEX)
+ if (auto delegate = FlexDelegate::Create()) {
(**interpreter)
.ModifyGraphWithDelegate(std::move(delegate),
/*allow_dynamic_tensors=*/true);