NumpyArrayInitializer¶
- class paddle.fluid.initializer. NumpyArrayInitializer ( value ) [source]
-
Init an parameter with an numpy array This op initialize the variable by numpy array.
- Parameters
-
value (numpy) – numpy array to initialize the variable
- Returns
-
A Tensor variable initialized by numpy.
Examples
import paddle.fluid as fluid import numpy x = fluid.data(name="x", shape=[2, 1], dtype='float32') fc = fluid.layers.fc(input=x, size=10, param_attr=fluid.initializer.NumpyArrayInitializer(numpy.array([1,2])))
-
forward
(
var,
block=None
)
forward¶
-
Initialize the input tensor with Numpy array.
- 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