enable_dygraph

paddle. enable_dygraph ( place=None ) [source]

Note

Dynamic graph mode is turn ON by default since paddle 2.0.0

This API turn OFF static graph mode. You can turn ON static graph mode by enable_static .

Parameters

place (paddle.CPUPlace|paddle.CUDAPlace|str, optional) – Place to run dynamic graph. Default: None. Which means that the running place will be determined according to the way of paddle compilation. If place is string, It can be cpu, and gpu:x, where x is the index of the GPUs.

Returns

None

Examples

import paddle
print(paddle.in_dynamic_mode())  # True, dynamic mode is turn ON by default since paddle 2.0.0

paddle.enable_static()
print(paddle.in_dynamic_mode())  # False, Now we are in static mode

paddle.disable_static()
print(paddle.in_dynamic_mode())  # True, Now we are in dynamic mode