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

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

上级 7fab7923
...@@ -5310,6 +5310,9 @@ def l2_normalize(x, axis, epsilon=1e-12, name=None): ...@@ -5310,6 +5310,9 @@ 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():
if in_dygraph_mode():
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, _, out = _legacy_C_ops.norm(x, 'axis', 1 if axis is None else axis,
'epsilon', epsilon) 'epsilon', epsilon)
return out return out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册