class brainpy.dnn.Dense(num_in, num_out, W_initializer=XavierNormal(scale=1.0, mode=fan_avg, in_axis=-2, out_axis=-1, distribution=truncated_normal, rng=[2459466628 2755113083]), b_initializer=ZeroInit, mode=None, name=None)[source]#

A linear transformation applied over the last dimension of the input.

Mathematically, this node can be defined as:

\[y = x \cdot weight + b\]
  • num_in (int) – The number of the input feature. A positive integer.

  • num_out (int) – The number of the output features. A positive integer.

  • W_initializer (optional, Initializer) – The weight initialization.

  • b_initializer (optional, Initializer) – The bias initialization.

  • mode (Mode) – Enable training this node or not. (default True)

offline_fit(target, fit_record)[source]#

The offline training interface for the Dense node.


The function to specify the updating rule.