get_option_value

Applicable Products

All processors

Function Usage

Returns the compilation option string value corresponding to a key.

Prototype

1
get_option_value(key: str) -> str

Parameters

Parameter

Input/Output

Description

key

Input

Compilation option key name, which is of the string type.

Returns

The compilation option string value corresponding to the key

Restrictions

  • The key must exist and be readable. Otherwise, RuntimeError is thrown.
  • It can be used only in the current run call stack.

Example

1
2
3
4
5
6
7
8
from ge.passes import FusionBasePass, PassContext


class MyPass(FusionBasePass):
    def run(self, graph, context: PassContext):
        # Read the compilation option in run().
        opt = context.get_option_value("some.option.key")
        return True

For more usage details, see Example of a Fusion Pass.