diff --git a/tf_adapter/python/npu_bridge/estimator/npu/npu_scope.py b/tf_adapter/python/npu_bridge/estimator/npu/npu_scope.py index 12f8075b91b84586d5575f3ef7c00650cbcd463e..e8a87e6a01d974e51210edf0596d5823e5bb3b74 100644 --- a/tf_adapter/python/npu_bridge/estimator/npu/npu_scope.py +++ b/tf_adapter/python/npu_bridge/estimator/npu/npu_scope.py @@ -206,3 +206,15 @@ def npu_graph_slice_scope(slice_num=None): if slice_num is not None: util.check_positive_integer(slice_num, "slice_num") return ops.name_scope_v2("".join(["SliceNum-", str(slice_num), "-NpuGraphSlicing", str(slice_num)])) + + +@contextlib.contextmanager +def disable_autofuse(): + """ + Disable the autofuse of operators within the scope. + """ + attrs = { + "_disable_autofuse_scope": attr_value_pb2.AttrValue(b=True) + } + with ops.get_default_graph()._attr_scope(attrs): + yield \ No newline at end of file