From 5987362c4171f0d098bdc5b28308916c0df2f34c Mon Sep 17 00:00:00 2001 From: Jian Li Date: Tue, 3 Sep 2019 07:39:18 -0700 Subject: [PATCH] change calibrator delegate mechanism to not mark graph immutable. PiperOrigin-RevId: 266925666 --- .../optimize/calibration/node_info_delegate.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tensorflow/lite/tools/optimize/calibration/node_info_delegate.cc b/tensorflow/lite/tools/optimize/calibration/node_info_delegate.cc index 2b9197498b0..84031761b30 100644 --- a/tensorflow/lite/tools/optimize/calibration/node_info_delegate.cc +++ b/tensorflow/lite/tools/optimize/calibration/node_info_delegate.cc @@ -33,11 +33,14 @@ TfLiteStatus NodeInfoDelegatePrepare(TfLiteContext* context, } // namespace TfLiteDelegate CreateNodeInfoDelegate(NodeInfoDelegateParams* params) { - return {/*data_ */ params, - /* Prepare */ NodeInfoDelegatePrepare, - /* CopyFromBufferHandle*/ nullptr, - /* CopyToBufferHandle*/ nullptr, - /* FreeBufferHandle*/ nullptr}; + auto delegate = TfLiteDelegateCreate(); + delegate.data_ = params; + delegate.Prepare = NodeInfoDelegatePrepare; + delegate.CopyFromBufferHandle = nullptr; + delegate.CopyToBufferHandle = nullptr; + delegate.FreeBufferHandle = nullptr; + delegate.flags = kTfLiteDelegateFlagsAllowDynamicTensors; + return delegate; } TfLiteStatus NodeInfoDelegateObserver::OnDelegatePrepareCalled(