braintools.init.param

Contents

braintools.init.param#

braintools.init.param(init, sizes, batch_size=None, allow_none=True, allow_scalar=True, **param_kwargs)#

Initialize parameters.

Parameters:
  • init (Callable | Array | ndarray | bool | number | bool | int | float | complex | Quantity | State | Param) –

    The initialization of the parameter.

    • If it is None, the created parameter will be None.

    • If it is a callable function \(f\), the f(size) will be returned.

    • If it is an instance of init.Initializer`, the f(size) will be returned.

    • If it is a tensor, then this function check whether tensor.shape is equal to the given size.

  • sizes (int | Sequence[int]) – The shape of the parameter.

  • batch_size (int | None) – The batch size.

  • allow_none (bool) – Whether allow the parameter is None.

  • allow_scalar (bool) – Whether allow the parameter is a scalar value.

  • **param_kwargs – Additional keyword arguments passed to the initialization.

Returns:

param – The initialized parameter.

Return type:

ArrayType, float, int, bool, None

See also

noise, state