diff --git a/tutorials/source_en/use/debugging_in_pynative_mode.md b/tutorials/source_en/use/debugging_in_pynative_mode.md index 66a7d9f0a146ebd9ff0601e7111b05f8c429d740..d573a11c2a7f05686ad2ce4d416bcf2dc560cdc3 100644 --- a/tutorials/source_en/use/debugging_in_pynative_mode.md +++ b/tutorials/source_en/use/debugging_in_pynative_mode.md @@ -99,7 +99,7 @@ print(output.asnumpy()) [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 @@ -273,14 +273,11 @@ During network training, obtain the gradient, call the optimizer to optimize par import numpy as np import mindspore.nn as nn 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.common import dtype as mstype -from mindspore.nn.wrap.cell_wrapper import WithLossCell -from mindspore.nn.loss import SoftmaxCrossEntropyWithLogits -from mindspore.nn.optim import Momentum +from mindspore import context, Tensor, ParameterTuple +from mindspore.common.initializer import TruncatedNormal +from mindspore.nn import Dense, WithLossCell, SoftmaxCrossEntropyWithLogits, Momentum context.set_context(mode=context.PYNATIVE_MODE, device_target="GPU") @@ -377,4 +374,4 @@ print(loss) 2.3050091 ``` -In the preceding execution, an intermediate result of network execution can be obtained at any required place in construct function, and the network can be debugged by using the Python Debugger (pdb). \ No newline at end of file +In the preceding execution, an intermediate result of network execution can be obtained at any required place in construct function, and the network can be debugged by using the Python Debugger (pdb). diff --git a/tutorials/source_zh_cn/use/debugging_in_pynative_mode.md b/tutorials/source_zh_cn/use/debugging_in_pynative_mode.md index 3967bb540727c15443d132900971eb49c5eb6b84..0357e8fb3e94f0eeded4242190efbdbeaef3ef7a 100644 --- a/tutorials/source_zh_cn/use/debugging_in_pynative_mode.md +++ b/tutorials/source_zh_cn/use/debugging_in_pynative_mode.md @@ -99,6 +99,7 @@ print(output.asnumpy()) [3. 3. 3.]] ``` +> PyNative不支持并行执行和summary功能,图模式的并行和summary相关算子不能使用。 ### 提升PyNative性能 @@ -272,14 +273,11 @@ print(mainf(1,2)) import numpy as np import mindspore.nn as nn 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.common import dtype as mstype -from mindspore.nn.wrap.cell_wrapper import WithLossCell -from mindspore.nn.loss import SoftmaxCrossEntropyWithLogits -from mindspore.nn.optim import Momentum +from mindspore import context, Tensor, ParameterTuple +from mindspore.common.initializer import TruncatedNormal +from mindspore.nn import Dense, WithLossCell, SoftmaxCrossEntropyWithLogits, Momentum context.set_context(mode=context.PYNATIVE_MODE, device_target="GPU") @@ -376,4 +374,4 @@ print(loss) 2.3050091 ``` -上述执行方式中,可以在construct函数任意需要的地方设置断点,获取网络执行的中间结果,通过pdb的方式对网络进行调试。 \ No newline at end of file +上述执行方式中,可以在`construct`函数任意需要的地方设置断点,获取网络执行的中间结果,通过pdb的方式对网络进行调试。