提交 14306420 编写于 作者: Z zhhsplendid

Add convert_ifelse, test=develop

上级 bf447e60
...@@ -460,7 +460,7 @@ def create_convert_ifelse_node(return_name_ids, ...@@ -460,7 +460,7 @@ def create_convert_ifelse_node(return_name_ids,
false_func, false_func,
is_if_expr=False): is_if_expr=False):
""" """
Create `fluid.dygraph.dygraph_to_static.convert_operators.convert_ifelse( Create `paddle.jit.dygraph_to_static.convert_operators.convert_ifelse(
pred, true_fn, false_fn, true_args, false_args, return_vars)` pred, true_fn, false_fn, true_args, false_args, return_vars)`
to replace original `python if/else` statement. to replace original `python if/else` statement.
""" """
...@@ -491,7 +491,7 @@ def create_convert_ifelse_node(return_name_ids, ...@@ -491,7 +491,7 @@ def create_convert_ifelse_node(return_name_ids,
return_vars = create_name_nodes(return_name_ids) return_vars = create_name_nodes(return_name_ids)
convert_ifelse_layer = gast.parse( convert_ifelse_layer = gast.parse(
'fluid.dygraph.dygraph_to_static.convert_operators.convert_ifelse(' 'paddle.jit.dygraph_to_static.convert_operators.convert_ifelse('
'{pred}, {true_fn}, {false_fn}, {true_args}, {false_args}, {return_vars})'. '{pred}, {true_fn}, {false_fn}, {true_args}, {false_args}, {return_vars})'.
format( format(
pred=ast_to_source_code(pred), pred=ast_to_source_code(pred),
......
...@@ -15,6 +15,7 @@ from __future__ import print_function ...@@ -15,6 +15,7 @@ from __future__ import print_function
from ...fluid.dygraph.dygraph_to_static.convert_operators import cast_bool_if_necessary #DEFINE_ALIAS from ...fluid.dygraph.dygraph_to_static.convert_operators import cast_bool_if_necessary #DEFINE_ALIAS
from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_assert #DEFINE_ALIAS from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_assert #DEFINE_ALIAS
from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_ifelse #DEFINE_ALIAS
from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_len #DEFINE_ALIAS from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_len #DEFINE_ALIAS
from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_and #DEFINE_ALIAS from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_and #DEFINE_ALIAS
from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_not #DEFINE_ALIAS from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_not #DEFINE_ALIAS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册