未验证 提交 f166ecc3 编写于 作者: K kangguangli 提交者: GitHub

[NewIR] refine new ir flag check (#56489)

* refine new ir flag check

* simplify

* simplify

* fix
上级 0c4354b2
...@@ -25,6 +25,10 @@ from ..fluid.variable_index import _setitem_impl_, _setitem_static ...@@ -25,6 +25,10 @@ from ..fluid.variable_index import _setitem_impl_, _setitem_static
__all__ = [] __all__ = []
def evaluate_flag(val) -> bool:
return str(val).lower() not in ('false', 'off', '0', 'none')
@static_only @static_only
def data(name, shape, dtype=None, lod_level=0): def data(name, shape, dtype=None, lod_level=0):
""" """
...@@ -120,7 +124,8 @@ def data(name, shape, dtype=None, lod_level=0): ...@@ -120,7 +124,8 @@ def data(name, shape, dtype=None, lod_level=0):
need_check_feed=True, need_check_feed=True,
) )
if os.environ.get("FLAGS_enable_new_ir_in_executor", None): is_new_ir_mode = os.environ.get("FLAGS_enable_new_ir_in_executor", None)
if evaluate_flag(is_new_ir_mode):
helper = LayerHelper('data', **locals()) helper = LayerHelper('data', **locals())
helper.append_op( helper.append_op(
type='data', type='data',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册