From bcbb7a97d0b6acbc83f9da619c031d3f1516409f Mon Sep 17 00:00:00 2001 From: zyfncg Date: Thu, 18 Aug 2022 10:13:41 +0800 Subject: [PATCH] support selected_rows kernel for multiply in dygraph (#45217) --- paddle/phi/api/yaml/legacy_api.yaml | 3 ++- python/paddle/fluid/clip.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/phi/api/yaml/legacy_api.yaml b/paddle/phi/api/yaml/legacy_api.yaml index 43d1956ad47..ef25d3a6456 100755 --- a/paddle/phi/api/yaml/legacy_api.yaml +++ b/paddle/phi/api/yaml/legacy_api.yaml @@ -1860,7 +1860,8 @@ infer_meta : func : ElementwiseInferMeta kernel : - func : multiply + func : multiply {dense, dense -> dense}, + multiply_sr {selected_rows, dense -> selected_rows} backward : multiply_grad - api : nearest_interp diff --git a/python/paddle/fluid/clip.py b/python/paddle/fluid/clip.py index dbe31bdf6fd..dd69630b53f 100644 --- a/python/paddle/fluid/clip.py +++ b/python/paddle/fluid/clip.py @@ -555,7 +555,7 @@ class ClipGradByGlobalNorm(ClipGradBase): if need_clip: clip_input = (clip_var.astype('float16') if g.dtype == core.VarDesc.VarType.FP16 else clip_var) - new_grad = _C_ops.elementwise_mul(g, clip_input) + new_grad = layers.elementwise_mul(g, clip_input) params_and_grads.append((p, new_grad)) else: params_and_grads.append((p, g)) -- GitLab