ncalab.autostepper

Classes

AutoStepper

Helps selecting number of timesteps based on NCA activity.

Module Contents

class ncalab.autostepper.AutoStepper(min_steps: int = 10, max_steps: int = 100, plateau: int = 5, verbose: bool = False, threshold: float = 0.01)

Helps selecting number of timesteps based on NCA activity.

Parameters:
  • min_steps (int, optional) – Minimum number of timesteps to always execute, defaults to 10.

  • max_steps (int, optional) – Terminate after maximum number of steps, defaults to 100.

  • plateau (int) – Number of steps that is considered a plateau, defaults to 5.

  • verbose (bool) – Whether to log interruption to stdout, defaults to False.

  • threshold (float) – Score threshold, defaults to 1e-2.

min_steps = 10
max_steps = 100
plateau = 5
verbose = False
threshold = 0.01
cooldown = 0
hidden_i: torch.Tensor | None = None
hidden_i_1: torch.Tensor | None = None
_score() torch.Tensor

Calculates activity score.

Method check() uses this score to determine if the NCA is inactive.

Returns:

Activity score estimate.

Return type:

torch.Tensor

_check(step: int) bool

Checks whether to interrupt inference after the current step.

Parameters:

step (int) – Current NCA inference step.

Returns:

Whether to interrupt inference after the current step.

Return type:

bool

run(nca: ncalab.models.AbstractNCAModel, x)
__call__(*args: Any, **kwargs: Any) Any