未验证 提交 def71d38 编写于 作者: W Weilong Wu 提交者: GitHub

[Eager] fix norm interface under different mode (#45642)

上级 7fab7923
...@@ -5310,8 +5310,11 @@ def l2_normalize(x, axis, epsilon=1e-12, name=None): ...@@ -5310,8 +5310,11 @@ def l2_normalize(x, axis, epsilon=1e-12, name=None):
if len(x.shape) == 1: if len(x.shape) == 1:
axis = 0 axis = 0
if _non_static_mode(): if _non_static_mode():
_, out = _legacy_C_ops.norm(x, 'axis', 1 if axis is None else axis, if in_dygraph_mode():
'epsilon', epsilon) out, _ = _C_ops.norm(x, 1 if axis is None else axis, epsilon, False)
elif _in_legacy_dygraph():
_, out = _legacy_C_ops.norm(x, 'axis', 1 if axis is None else axis,
'epsilon', epsilon)
return out return out
check_variable_and_dtype(x, "X", ("float16", "float32", "float64"), "norm") check_variable_and_dtype(x, "X", ("float16", "float32", "float64"), "norm")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册