in_dynamic_mode

paddle. in_dynamic_mode ( )

Note

Dynamic graph mode is turn ON by default since paddle 2.0.0

This API checks whether paddle runs in dynamic graph mode.

You can turn ON static graph mode by enable_static , and turn OFF static graph mode by disable_static .

Returns

Whether paddle runs in dynamic graph mode.

Return type

bool

Examples

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

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

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