sequince.steps.mutation.repeated#
Complete mutation blocks with explicit rounds and metric ownership.
Classes#
Mutation and post-round outputs plus one complete diagnostic record. |
|
Run fixed mutation rounds with one shared collection of metric states. |
Module Contents#
- class sequince.steps.mutation.repeated.RepeatedMutationStepOutput[source]#
Mutation and post-round outputs plus one complete diagnostic record.
- class sequince.steps.mutation.repeated.RepeatedMutationStep(mutation, *, n_rounds=1, n_steps=None, after_round=None)[source]#
Bases:
sequince.steps.base.SMCStepRun fixed mutation rounds with one shared collection of metric states.
n_stepsis the total default budget. If omitted, use the child’s configured length timesn_rounds.apply_with_n_stepsoverrides the total for a single call. Budgets are divided evenly, with the remainder assigned to the first rounds.after_roundis an ordinary SMCStep, executed after every round, including zero-step rounds and the final round. It never receives metric state. The mutation refreshes references on entering the following round without recording the intervening displacement or changing frozen scaling.Metrics are configured on the mutation child. Runtime state is local to the block call and passed explicitly through the rounds. Nested blocks share the same state and only the outermost block finalizes metrics. Fixed schedules execute all rounds even if a child requests stopping; the stop flags remain available to the enclosing SMC runner.
- Parameters:
mutation (sequince.steps.mutation.base.MutationStep | RepeatedMutationStep)
n_rounds (int)
n_steps (int | None)
after_round (sequince.steps.base.SMCStep | None)
- n_rounds = 1#
- mutation#
- after_round = None#
- property metrics: sequince.steps.mutation.metrics.MutationMetrics#
Static metric configuration owned by the mutation child.
- Return type:
sequince.steps.mutation.metrics.MutationMetrics
- apply_with_mutation_state(state, context, rng, *, n_steps, mutation_state=None)[source]#
Run all rounds and return mutation state without finalizing it.
Nonestarts a new block. An existing state continues an enclosing block, preserving its metric scaling and cumulative bookkeeping.- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (Any)
n_steps (int)
mutation_state (sequince.steps.mutation.metrics.MutationStepState | None)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext, RepeatedMutationStepOutput, sequince.steps.mutation.metrics.MutationStepState | None]
- initialize_functional_state_and_context(state, context)[source]#
Return shape-complete inputs for
apply_functional.Steps whose functional output adds array leaves should initialize matching leaves here so one compiled signature can be reused from the first iteration onward.
- load_state_dict(state)[source]#
Restore state produced by
state_dict().- Parameters:
state (collections.abc.Mapping[str, Any])
- Return type:
None