BiasNode

class BiasNode(*shape: int | None)[source]

Bases: Node

Trainable bias node for unsupervised predictive coding.

Parameters:

*shape (int | None) – shape of the learned bias.

bias

learned bias \(\mathbf{b}\).

Type:

Parameter

error(pred: Tensor) Tensor[source]

Error between the prediction and node state.

\[\boldsymbol{\varepsilon} = \mathbf{b} - \boldsymbol{\mu}\]
Parameters:

pred (Tensor) – predicted bias \(\boldsymbol{\mu}\).

Returns:

elementwise error \(\boldsymbol{\varepsilon}\).

Return type:

Tensor

forward(inputs: Tensor, **kwargs) Tensor[source]

Expands bias tensor for the network.

Parameters:

inputs (Tensor) – tensor to use as the shape for the returned bias.

Returns:

expanded bias tensor.

Return type:

Tensor

Tip

inputs should have the desired shape (including the batch dimension) to use the returned bias as a prediction for initialization/inference. The contents, device, and data type of inputs are unused.

reset() None[source]

Resets transient node state.