mindspore.JitConfig

class mindspore.JitConfig(jit_level='O1', exc_mode='auto', **kwargs)[source]

Jit config for compile.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • jit_level (str) –

    Option for argument level for Optimization of lift graph. Supports [“O0”, “O1”, “O2”, “O3”]. Default: "O1" .

    • ”O0”: Basic optimization.

    • ”O1”: Manual optimization.

    • ”O2”: Manual optimization and graph computation fusion.

    • ”O3”: Performance optimization, no generalization guaranteed.

  • exc_mode (str) –

    Mode for execute the network. Supports [“auto”, “sink”, “no_sink”]. Default: "auto" .

    • ”auto”: Automatic Policies.

    • ”sink”: Build computational graphs with the sink mode.

    • ”no_sink”: Build computational graphs with no sink mode.

  • **kwargs (dict) – A dictionary of keyword arguments that the class needs.

Examples

>>> from mindspore import JitConfig
>>>
>>> jitconfig = JitConfig(jit_level="O1")
>>>
>>> # Define the network structure of LeNet5. Refer to
>>> # https://gitee.com/mindspore/docs/blob/r2.1/docs/mindspore/code/lenet.py
>>> net = LeNet5()
>>>
>>> net.set_jit_config(jitconfig)