compile_etrace_graph

compile_etrace_graph#

class braintrace.compile_etrace_graph(model, *model_args, include_hidden_perturb=True)[source]#

Constructs the eligibility trace graph for a given model based on the provided inputs.

This is the most important method for the eligibility trace graph. It builds the graph for the model, tracking the relationship between the etrace weights ParamState, the etrace state HiddenState, and the etrace operations ETP primitives, which will be used for computing the weight spatial gradients, the hidden state Jacobian, and the hidden state-weight Jacobian.

This function is crucial for building the eligibility trace graph, which tracks the relationships between eligibility trace weights, states, and operations. These relationships are used to compute weight spatial gradients, hidden state Jacobians, and hidden state-weight Jacobians.

Parameters:
  • model (Module) – The model for which the eligibility trace graph is to be built.

  • model_args (Tuple) – The arguments required by the model.

  • include_hidden_perturb (bool) – Indicates whether to include hidden perturbations in the graph. Defaults to True.

Returns:

The compiled eligibility trace graph containing module information, hidden groups, hidden parameter operation relations, and optional hidden perturbations.

Return type:

ETraceGraph