Skip to content

Commit 4ca98f7

Browse files
committed
Turn off ITEX optimization pass (#196)
Signed-off-by: Lv, Liang1 <[email protected]>
1 parent a825e77 commit 4ca98f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

neural_compressor/adaptor/tf_utils/graph_converter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ def _inference(self, model):
160160
Args:
161161
model(TensorflowBaseModel): input TensorflowBaseModel
162162
"""
163+
# ITEX optimization has broken INC calibration process.
164+
# INC needs turn off ITEX optimization pass in calibration stage.
165+
# TODO ITEX will provide API to replace setting environment variable.
166+
if self.itex_mode:
167+
os.environ["ITEX_REMAPPER"] = "0"
163168
sess = model.sess
164169
iter_op = model.iter_op
165170
input_tensor = model.input_tensor
@@ -238,6 +243,8 @@ def check_shape(tensor, data):
238243
feed_dict, output_tensor, self.calib_iteration)
239244
if idx + 1 == self.calib_iteration:
240245
break
246+
if self.itex_mode:
247+
os.environ["ITEX_REMAPPER"] = "1"
241248

242249
def _check_tf_version(self):
243250
is_supported_version = False

0 commit comments

Comments
 (0)