pyhgf.model.hybrid.PCModule#

class pyhgf.model.hybrid.PCModule[source]#

Base class for all parts in a mixed pipeline.

A part contributes two core responsibilities to a mixed training pipeline:

  1. Declaration: The part object (this class and its subclasses) declares which computations learn and which are frozen, along with their configuration (optimiser, layer sizes, activation functions, etc.).

  2. State management: Each part declares its state structure via init_state(), which returns the state pytree this part holds (network beliefs, optimiser moments, etc.). Execution is delegated to FusedPipeline.

All subclasses must implement:

  • __init__(...): Store part configuration (layer sizes, optimiser, etc.)

  • init_state(): Return this part’s state pytree

The executor (FusedPipeline) calls init_state() to initialise the part’s state, threads it through forward/backward walks in one compiled JAX program, and writes it back via a merge() closure.

Notes

Subclasses that do not define both __init__ and init_state raise a TypeError at class definition time. See DeepNetworkAdapter, EquinoxAdapter, PCSequential, and Residual for examples.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

init_state()

Initialise and return this part's state pytree.