init_on_cpu

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

Force the variable to be inited on CPU.

Examples

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