ConstantInitializer¶
- class paddle.fluid.initializer. ConstantInitializer ( value=0.0, force_cpu=False ) [source]
-
Implements the constant initializer
- Parameters
-
value (float32) – constant value to initialize the variable
Examples
import paddle import paddle.fluid as fluid paddle.enable_static() x = fluid.data(name="data", shape=[8, 32, 32], dtype="float32") fc = fluid.layers.fc( input=x, size=10, param_attr=fluid.initializer.Constant(value=2.0))
-
forward
(
var,
block=None
)
forward¶
-
Initialize the input tensor with constant.
- Parameters
-
var (Tensor) – Tensor that needs to be initialized.
block (Block, optional) – The block in which initialization ops should be added. Used in static graph only, default None.
- Returns
-
The initialization op