From 832458d516ad52454ce3227a2983f8b347708b1b Mon Sep 17 00:00:00 2001 From: Steffy-zxf <48793257+Steffy-zxf@users.noreply.github.com> Date: Thu, 15 Oct 2020 20:33:26 +0800 Subject: [PATCH] update code examples for paddle.sums update code examples for paddle.sums --- python/paddle/fluid/dygraph/varbase_patch_methods.py | 4 ++-- python/paddle/fluid/framework.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/dygraph/varbase_patch_methods.py b/python/paddle/fluid/dygraph/varbase_patch_methods.py index 39c6740d832..0f65bdd6f21 100644 --- a/python/paddle/fluid/dygraph/varbase_patch_methods.py +++ b/python/paddle/fluid/dygraph/varbase_patch_methods.py @@ -162,8 +162,8 @@ def monkey_patch_varbase(): # there is no one need gradient on it. tmp.stop_gradient=False inputs.append(tmp) - ret = paddle.sums(inputs) - loss = paddle.fluid.layers.reduce_sum(ret) + ret = paddle.add_n(inputs) + loss = paddle.sum(ret) loss.backward() """ diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index a4cb92f7297..d31b4341032 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -1192,8 +1192,8 @@ class Variable(object): # there is no one need gradient on it. tmp.stop_gradient=False inputs.append(tmp) - ret = paddle.sums(inputs) - loss = paddle.fluid.layers.reduce_sum(ret) + ret = paddle.add_n(inputs) + loss = paddle.sum(ret) loss.backward() """ -- GitLab