未验证 提交 3559e5a3 编写于 作者: S SunGaofeng 提交者: GitHub

fix bug when iterate in locals_var.items() in python3 (#17948)

test=develop
上级 9f519baf
......@@ -89,7 +89,7 @@ def uniform_random(shape, dtype='float32', min=-1.0, max=1.0, seed=0):
if not isinstance(dtype, core.VarDesc.VarType):
dtype = convert_np_dtype_to_dtype_(dtype)
locals_var = locals()
locals_var = locals().copy()
kwargs = dict()
for name, val in locals_var.items():
if val is not None:
......@@ -103,7 +103,7 @@ _hard_shrink_ = generate_layer_fn('hard_shrink')
def hard_shrink(x, threshold=None):
locals_var = locals()
locals_var = locals().copy()
kwargs = dict()
for name, val in locals_var.items():
if val is not None:
......@@ -124,7 +124,7 @@ _cum_sum_ = generate_layer_fn('cumsum')
def cumsum(x, axis=None, exclusive=None, reverse=None):
locals_var = locals()
locals_var = locals().copy()
kwargs = dict()
for name, val in locals_var.items():
if val is not None:
......@@ -145,7 +145,7 @@ _thresholded_relu_ = generate_layer_fn('thresholded_relu')
def thresholded_relu(x, threshold=None):
locals_var = locals()
locals_var = locals().copy()
kwargs = dict()
for name, val in locals_var.items():
if val is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册