From a5b0758ff7d9eaca14dcc62c51d51081937f8edc Mon Sep 17 00:00:00 2001 From: mamingjie-China <52770436+mamingjie-China@users.noreply.github.com> Date: Mon, 24 Feb 2020 00:03:55 +0800 Subject: [PATCH] fix the doc in elementwise_add elementwise_sub elementwise_mul elementwise_div MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix the doc in elementwise ops,add the override function in the doc --- python/paddle/fluid/layers/nn.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index b804984efbd..bef581daf09 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -10407,13 +10407,14 @@ Examples: x = fluid.data(name="x", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32') z = fluid.layers.elementwise_add(x, y) + # z = x + y place = fluid.CPUPlace() exe = fluid.Executor(place) z_value = exe.run(feed=gen_data(), fetch_list=[z.name]) - print(z_value) #[3., 8., 6.] + print(z_value) # [3., 8., 6.] .. code-block:: python @@ -10430,6 +10431,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32') z = fluid.layers.elementwise_add(x, y, axis=1) + # z = x + y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10454,6 +10456,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32') z = fluid.layers.elementwise_add(x, y, axis=3) + # z = x + y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10488,13 +10491,14 @@ Examples: x = fluid.data(name="x", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32') z = fluid.layers.elementwise_div(x, y) + # z = x / y place = fluid.CPUPlace() exe = fluid.Executor(place) z_value = exe.run(feed=gen_data(), fetch_list=[z.name]) - print(z_value) #[2., 0.6, 2.] + print(z_value) # [2., 0.6, 2.] .. code-block:: python @@ -10511,6 +10515,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32') z = fluid.layers.elementwise_div(x, y, axis=1) + # z = x / y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10535,6 +10540,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32') z = fluid.layers.elementwise_div(x, y, axis=3) + # z = x / y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10569,13 +10575,14 @@ Examples: x = fluid.data(name="x", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32') z = fluid.layers.elementwise_sub(x, y) + # z = x - y place = fluid.CPUPlace() exe = fluid.Executor(place) z_value = exe.run(feed=gen_data(), fetch_list=[z.name]) - print(z_value) #[1., -2., 2.] + print(z_value) # [1., -2., 2.] .. code-block:: python @@ -10592,6 +10599,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32') z = fluid.layers.elementwise_sub(x, y, axis=1) + # z = x - y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10616,6 +10624,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32') z = fluid.layers.elementwise_sub(x, y, axis=3) + # z = x - y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10650,13 +10659,14 @@ Examples: x = fluid.data(name="x", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32') z = fluid.layers.elementwise_mul(x, y) + # z = x * y place = fluid.CPUPlace() exe = fluid.Executor(place) z_value = exe.run(feed=gen_data(), fetch_list=[z.name]) - print(z_value) #[2., 15., 8.] + print(z_value) # [2., 15., 8.] .. code-block:: python @@ -10673,6 +10683,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32') z = fluid.layers.elementwise_mul(x, y, axis=1) + # z = x * y place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -10697,6 +10708,7 @@ Examples: x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32') z = fluid.layers.elementwise_mul(x, y, axis=3) + # z = x * y place = fluid.CPUPlace() exe = fluid.Executor(place) -- GitLab