force_init_on_cpu

paddle.fluid.initializer.force_init_on_cpu()[source]

The flag of whether force to init variables on CPU.

Returns

the state if we should force init on CPU.

Return type

bool

Examples

import paddle.fluid as fluid
if fluid.initializer.force_init_on_cpu():
    step = fluid.layers.create_global_var(
        shape=[2,3], value=1.0, dtype='float32')