From 311d94e266da4f614458018457de90b98355561f Mon Sep 17 00:00:00 2001 From: zhangz0911gm Date: Thu, 26 Nov 2020 11:37:13 +0800 Subject: [PATCH] updating notes for remaining classes's examples --- mindspore/ops/composite/base.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mindspore/ops/composite/base.py b/mindspore/ops/composite/base.py index 1ecbff297c..bf52659be5 100644 --- a/mindspore/ops/composite/base.py +++ b/mindspore/ops/composite/base.py @@ -205,7 +205,8 @@ class GradOperation(GradOperation_): >>> >>> x = Tensor([[0.5, 0.6, 0.4], [1.2, 1.3, 1.1]], dtype=mstype.float32) >>> y = Tensor([[0.01, 0.3, 1.1], [0.1, 0.2, 1.3], [2.1, 1.2, 3.3]], dtype=mstype.float32) - >>> GradNetWrtX(Net())(x, y) + >>> output = GradNetWrtX(Net())(x, y) + >>> print(output) Tensor(shape=[2, 3], dtype=Float32, [[1.4100001 1.5999999 6.6 ] [1.4100001 1.5999999 6.6 ]]) @@ -221,7 +222,8 @@ class GradOperation(GradOperation_): >>> >>> x = Tensor([[0.8, 0.6, 0.2], [1.8, 1.3, 1.1]], dtype=mstype.float32) >>> y = Tensor([[0.11, 3.3, 1.1], [1.1, 0.2, 1.4], [1.1, 2.2, 0.3]], dtype=mstype.float32) - >>> GradNetWrtXY(Net())(x, y) + >>> output = GradNetWrtXY(Net())(x, y) + >>> print(output) (Tensor(shape=[2, 3], dtype=Float32, [[4.5099998 2.7 3.6000001] [4.5099998 2.7 3.6000001]]), Tensor(shape=[3, 3], dtype=Float32, @@ -241,7 +243,8 @@ class GradOperation(GradOperation_): >>> >>> x = Tensor([[0.8, 0.6, 0.2], [1.8, 1.3, 1.1]], dtype=mstype.float32) >>> y = Tensor([[0.11, 3.3, 1.1], [1.1, 0.2, 1.4], [1.1, 2.2, 0.3]], dtype=mstype.float32) - >>> GradNetWrtXYWithSensParam(Net())(x, y) + >>> output = GradNetWrtXYWithSensParam(Net())(x, y) + >>> print(output) (Tensor(shape=[2, 3], dtype=Float32, [[2.211 0.51 1.4900001] [5.588 2.68 4.07 ]]), Tensor(shape=[3, 3], dtype=Float32, @@ -261,7 +264,8 @@ class GradOperation(GradOperation_): >>> >>> x = Tensor([[0.8, 0.6, 0.2], [1.8, 1.3, 1.1]], dtype=mstype.float32) >>> y = Tensor([[0.11, 3.3, 1.1], [1.1, 0.2, 1.4], [1.1, 2.2, 0.3]], dtype=mstype.float32) - >>> GradNetWithWrtParams(Net())(x, y) + >>> output = GradNetWithWrtParams(Net())(x, y) + >>> print(output) (Tensor(shape=[1], dtype=Float32, [21.536]),) >>> >>> class GradNetWrtInputsAndParams(nn.Cell): @@ -276,7 +280,8 @@ class GradOperation(GradOperation_): >>> >>> x = Tensor([[0.1, 0.6, 1.2], [0.5, 1.3, 0.1]], dtype=mstype.float32) >>> y = Tensor([[0.12, 2.3, 1.1], [1.3, 0.2, 2.4], [0.1, 2.2, 0.3]], dtype=mstype.float32) - >>> GradNetWrtInputsAndParams(Net())(x, y) + >>> output = GradNetWrtInputsAndParams(Net())(x, y) + >>> print(output) ((Tensor(shape=[2, 3], dtype=Float32, [[3.52 3.9 2.6 ] [3.52 3.9 2.6 ]]), Tensor(shape=[3, 3], dtype=Float32,