context 中文
Posted singularity
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
以上是关于context 中文的主要内容,如果未能解决你的问题,请参考以下文章
包含 Context.Provider 和 Context.Consumer 的 React Context 测试组件
Provider.of(context, listen: false) 是不是等同于 context.read()?
DbModel.Context.tt 下缺少 DbModel.Context.cs 文件