From 361da5d86335c9a9f1e56fd8119c53642a6e5246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=A6=E6=99=93=E7=8E=B2?= <3174348550@qq.com> Date: Tue, 26 Aug 2025 16:07:48 +0800 Subject: [PATCH] modify code inconsistency --- tutorials/source_en/beginner/autograd.md | 2 +- tutorials/source_en/compile/static_graph.md | 17 +++++++++-------- tutorials/source_zh_cn/compile/static_graph.md | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tutorials/source_en/beginner/autograd.md b/tutorials/source_en/beginner/autograd.md index 788af9516d..9c8bfa57b4 100644 --- a/tutorials/source_en/beginner/autograd.md +++ b/tutorials/source_en/beginner/autograd.md @@ -50,7 +50,7 @@ print(loss) ``` ```text -1.342315 +1.3423151 ``` ## Differential Functions and Gradient Computing diff --git a/tutorials/source_en/compile/static_graph.md b/tutorials/source_en/compile/static_graph.md index 32226452fb..54a4de235c 100644 --- a/tutorials/source_en/compile/static_graph.md +++ b/tutorials/source_en/compile/static_graph.md @@ -592,7 +592,7 @@ The basic usage scenarios of \'List\' are as follows: ``` text output1:[1, 2, 3, 4, 'a'] - output2:[1, 2, 3, Tensor(shape=[1], dtype=Int64, value= [4]), Tensor(shape=[1], dtype=Int64, value= [5])] + output2:[1, 2, 3, Tensor(shape=[], dtype=Int64, value= 4), Tensor(shape=[], dtype=Int64, value= 5)] ``` - List.pop @@ -657,7 +657,7 @@ The basic usage scenarios of \'List\' are as follows: The results are as follows: ``` text - output1:[3, 2, 1] + output:[3, 2, 1] ``` - List.insert @@ -1706,7 +1706,7 @@ current extension base on AST compilation. The results are as follows: ``` text - [2, 3, 4] + [2 3 4] ``` - The assignment of subscripts for data types in third-party libraries @@ -1939,7 +1939,7 @@ The specific usage scenarios are as follows: The results are as follows: ``` text - out:{'y': 'a'} + out: {'y': 'a'} ``` - Support Dictionary Index Value Retrieval and Assignment @@ -2186,7 +2186,7 @@ shape is (2, 2) @mindspore.jit def construct(self): self.m = 3 - return + return 0 net = Net() net() @@ -2214,10 +2214,11 @@ shape is (2, 2) @mindspore.jit def construct(self): self.m2 = 3 - return + return 0 net = Net() net() + print(f"net.m2 is {net.m2}") ``` The results are as follows: @@ -2248,7 +2249,7 @@ shape is (2, 2) @mindspore.jit def construct(self): self.inner.x = 100 - return + return 0 net = Net() net() @@ -2336,7 +2337,7 @@ The results are as follows: y1 value is 2.0, dtype is Float32 y2 value is 2.0, dtype is Float32 y3 value is 2.0, dtype is Float64 -y4 value is 2.0, dtype is Float64 +y4 value is 2.0, dtype is Float32 ``` In the above example, you can see the difference related to creating \'Tensor\'. Due to the lack of Annotation indication in the Tensor diff --git a/tutorials/source_zh_cn/compile/static_graph.md b/tutorials/source_zh_cn/compile/static_graph.md index aa2021bbca..57f18b6776 100644 --- a/tutorials/source_zh_cn/compile/static_graph.md +++ b/tutorials/source_zh_cn/compile/static_graph.md @@ -1964,7 +1964,7 @@ print("res: ", res) 运行结果如下: ``` text -res: 2 +res: 2 ``` ### 支持属性设置与修改 -- Gitee