Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
docs
提交
b3305fde
D
docs
项目概览
MindSpore
/
docs
通知
5
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b3305fde
编写于
4月 15, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
4月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
!28 update pynative example code
Merge pull request !28 from wangqiuliang/update-pynative-example-code
上级
5d0255cd
82ae85e9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
15 deletion
+10
-15
tutorials/source_en/use/debugging_in_pynative_mode.md
tutorials/source_en/use/debugging_in_pynative_mode.md
+5
-8
tutorials/source_zh_cn/use/debugging_in_pynative_mode.md
tutorials/source_zh_cn/use/debugging_in_pynative_mode.md
+5
-7
未找到文件。
tutorials/source_en/use/debugging_in_pynative_mode.md
浏览文件 @
b3305fde
...
@@ -99,7 +99,7 @@ print(output.asnumpy())
...
@@ -99,7 +99,7 @@ print(output.asnumpy())
[
3.
3.
3.
]]
[
3.
3.
3.
]]
```
```
> Parallel execution and summary is not supported in PyNative mode, so parallel and summary related operators can not be used.
### Improving PyNative Performance
### Improving PyNative Performance
...
@@ -273,14 +273,11 @@ During network training, obtain the gradient, call the optimizer to optimize par
...
@@ -273,14 +273,11 @@ During network training, obtain the gradient, call the optimizer to optimize par
import
numpy
as
np
import
numpy
as
np
import
mindspore.nn
as
nn
import
mindspore.nn
as
nn
import
mindspore.ops.operations
as
P
import
mindspore.ops.operations
as
P
from
mindspore.nn
import
Dense
from
mindspore
import
context
,
Tensor
,
ParameterTuple
from
mindspore.common.initializer
import
TruncatedNormal
from
mindspore.ops
import
composite
as
C
from
mindspore.ops
import
composite
as
C
from
mindspore.common
import
dtype
as
mstype
from
mindspore.common
import
dtype
as
mstype
from
mindspore
.nn.wrap.cell_wrapper
import
WithLossCell
from
mindspore
import
context
,
Tensor
,
ParameterTuple
from
mindspore.
nn.loss
import
SoftmaxCrossEntropyWithLogits
from
mindspore.
common.initializer
import
TruncatedNormal
from
mindspore.nn
.optim
import
Momentum
from
mindspore.nn
import
Dense
,
WithLossCell
,
SoftmaxCrossEntropyWithLogits
,
Momentum
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
"GPU"
)
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
"GPU"
)
...
...
tutorials/source_zh_cn/use/debugging_in_pynative_mode.md
浏览文件 @
b3305fde
...
@@ -99,6 +99,7 @@ print(output.asnumpy())
...
@@ -99,6 +99,7 @@ print(output.asnumpy())
[
3.
3.
3.
]]
[
3.
3.
3.
]]
```
```
> PyNative不支持并行执行和summary功能,图模式的并行和summary相关算子不能使用。
### 提升PyNative性能
### 提升PyNative性能
...
@@ -272,14 +273,11 @@ print(mainf(1,2))
...
@@ -272,14 +273,11 @@ print(mainf(1,2))
import
numpy
as
np
import
numpy
as
np
import
mindspore.nn
as
nn
import
mindspore.nn
as
nn
import
mindspore.ops.operations
as
P
import
mindspore.ops.operations
as
P
from
mindspore.nn
import
Dense
from
mindspore
import
context
,
Tensor
,
ParameterTuple
from
mindspore.common.initializer
import
TruncatedNormal
from
mindspore.ops
import
composite
as
C
from
mindspore.ops
import
composite
as
C
from
mindspore.common
import
dtype
as
mstype
from
mindspore.common
import
dtype
as
mstype
from
mindspore
.nn.wrap.cell_wrapper
import
WithLossCell
from
mindspore
import
context
,
Tensor
,
ParameterTuple
from
mindspore.
nn.loss
import
SoftmaxCrossEntropyWithLogits
from
mindspore.
common.initializer
import
TruncatedNormal
from
mindspore.nn
.optim
import
Momentum
from
mindspore.nn
import
Dense
,
WithLossCell
,
SoftmaxCrossEntropyWithLogits
,
Momentum
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
"GPU"
)
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
"GPU"
)
...
@@ -376,4 +374,4 @@ print(loss)
...
@@ -376,4 +374,4 @@ print(loss)
2.3050091
2.3050091
```
```
上述执行方式中,可以在construct函数任意需要的地方设置断点,获取网络执行的中间结果,通过pdb的方式对网络进行调试。
上述执行方式中,可以在
`construct`
函数任意需要的地方设置断点,获取网络执行的中间结果,通过pdb的方式对网络进行调试。
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录