create_parameter

paddle. create_parameter ( shape, dtype, name=None, attr=None, is_bias=False, default_initializer=None ) [source]

This function creates a parameter. The parameter is a learnable variable, which can have gradient, and can be optimized.

Note

This is a very low-level API. This API is useful when you create operator by your self, instead of using layers.

Parameters
  • shape (list of int) – Shape of the parameter

  • dtype (str) – Data type of the parameter. It can be set as ‘float16’, ‘float32’, ‘float64’.

  • name (str, optional) – For detailed information, please refer to Name . Usually name is no need to set and None by default.

  • attr (ParamAttr, optional) – Attribute object of the specified argument. For detailed information, please refer to ParamAttr None by default, which means that ParamAttr will be initialized as it is.

  • is_bias (bool, optional) – This can affect which default initializer is chosen when default_initializer is None. If is_bias, initializer.Constant(0.0) will be used. Otherwise, Xavier() will be used.

  • default_initializer (Initializer, optional) – Initializer for the parameter

Returns

The created parameter.

Examples

>>> import paddle
>>> paddle.enable_static()
>>> W = paddle.create_parameter(shape=[784, 200], dtype='float32')

Used in the guide/tutorials