in_dygraph_mode

paddle.fluid.in_dygraph_mode()[source]

This function checks whether the program runs in dynamic graph mode or not. You can turn on dynamic graph mode with guard api.

Returns

Whether the program is running in dynamic graph mode.

Return type

bool

Examples

import paddle.fluid as fluid
if fluid.in_dygraph_mode():
    print('running in dygraph mode')
else:
    print('not running in dygraph mode')