Const

Contents

Const#

class brainstate.nn.Const(value, **param_kwargs)[source]#

A module has non-trainable constant parameter.

A convenience class that creates a fixed (non-trainable) parameter. Equivalent to ParamM(value, fit=False).

Parameters:

value (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – The constant value.

Examples

>>> import jax.numpy as jnp
>>> from brainstate.nn import Const
>>> const = Const(jnp.array([1.0, 2.0]))
>>> const.value()