set_code_level( level=100, also_to_stdout=False )
Sets the level to print code from specific level Ast Transformer. Code can be output to stdout by setting also_to_stdout.
There are two means to set the code level:
Call function set_code_level
Set environment variable TRANSLATOR_CODE_LEVEL
Note: set_code_level has a higher priority than the environment variable.
level (int) – The level to print code. Default is 100, which means to print the code after all AST Transformers.
also_to_stdout (bool) – Whether to also output code to sys.stdout.
import paddle paddle.jit.set_code_level(2) # It will print the transformed code at level 2, which means to print the code after second transformer, # as the date of August 28, 2020, it is CastTransformer. os.environ['TRANSLATOR_CODE_LEVEL'] = '3' # The code level is now 3, but it has no effect because it has a lower priority than `set_code_level`