未验证 提交 31c2c226 编写于 作者: Z zxcd 提交者: GitHub

clean fluid elementwise_max and square api. (#2852)

上级 2b01e405
......@@ -43,7 +43,7 @@ class ClipGradByGlobalNormWithLog(paddle.nn.ClipGradByGlobalNorm):
if g.type == core.VarDesc.VarType.SELECTED_ROWS:
merge_grad = layers.merge_selected_rows(g)
merge_grad = layers.get_tensor_from_selected_rows(merge_grad)
square = layers.square(merge_grad)
square = paddle.square(merge_grad)
sum_square = layers.reduce_sum(square)
sum_square_list.append(sum_square)
......@@ -66,7 +66,7 @@ class ClipGradByGlobalNormWithLog(paddle.nn.ClipGradByGlobalNorm):
shape=[1], dtype=global_norm_var.dtype, value=self.clip_norm)
clip_var = layers.elementwise_div(
x=max_global_norm,
y=layers.elementwise_max(x=global_norm_var, y=max_global_norm))
y=paddle.maximum(x=global_norm_var, y=max_global_norm))
for i, (p, g) in enumerate(params_grads):
if g is None:
continue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册