context 中文
def set_context(**kwargs):
"""
Set context for running environment.
Context should be configured before running your program. If there is no configuration,
it will be automatically set according to the device target by default.
Note:
Attribute name is required for setting attributes.
enable_graph_kernel (bool): Enable graph kernel fusion to optimize network execution performance.
Default: False.
If enable_graph_kernel is set to True, acceleration can be enabled.
For details of graph kernel fusion, please check
`Enabling Graph Kernel Fusion <https://www.mindspore.cn/docs/programming_guide
/en/master/enable_graph_kernel_fusion.html>`_.
grad_for_scalar (bool): Whether to get gradient for scalar. Default: False.
When grad_for_scalar is set to True, the function's scalar input can be derived.
Because the back-end does not support scaling operations currently,
this interface only supports simple operations that can be deduced by the front-end.
env_config_path (str): The path of mindspore environment config file.
Through context.set_context(env_config_path="./mindspore_config.json")
configure RDR:
- enable: controls whether the RDR is enabled to collect the key data during training and
save key data in the fault scenario. When set to true, the RDR will be turned on.
When set to false, the RDR will be turned off.
- mode: sets the mode of RDR on exporting data. When set to 1, the RDR only exports data
in the fault scenario. When set to 2, the RDR exports data in the fault scenario and the
normal end scenario. Default is 1.
- path: sets the path where RDR saves data. The current path must be absolute.
Memory reuse:
- mem_Reuse: controls whether the memory reuse function is turned on. When set to True,
- the memory reuse function is turned on. When set to False, the memory reuse function is turned off.
graph_kernel_flags (str) –
Optimization options of graph kernel fusion, and the priority is higher when it conflicts
with enable_graph_kernel. Only for experienced users.
For example, context.set_context(graph_kernel_flags="--opt_level=2 --dump_as_text"). Some general options:
- opt_level: Set the optimization level.
Default: 2. Graph kernel fusion can be enabled equivalently by setting opt_level greater than 0.
Available values are:
- 0: disables graph kernel fusion;
- 1: enables the basic fusion of operators;
- 2: includes all optimizations of level 1,
and turns on more optimizations such as CSE, arithmetic simplification and so on;
- 3: includes all optimizations of level 2, and turns on more optimizations such as SitchingFusion,
ParallelFusion and so on. Optimizations of this level are radical and unstable in some scenarios.
Be caution when using this level.
- dump_as_text: dump the detailed information of the key process as text files in the "graph_kernel_dump" directory.
Default: false.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2017-01-11 在联网时,两台linux服务器传输文件方法