fdtdx.GradientConfig

Bases: TreeClass

Configuration for gradient computation in simulations.

This class handles settings for automatic differentiation, supporting either invertible differentiation with a recorder or checkpointing-based differentiation.

Attributes:
  • method (Literal['reversible', 'checkpointed']) –

    Method for gradient computation. Can be either "reversible" when using the time reversible autodiff, or "checkpointed" for the exact checkpointing algorithm.

  • recorder (Recorder | None) –

    Optional recorder for invertible differentiation. Needs to be provided for reversible autodiff. Defaults to None

  • num_checkpoints (int | None) –

    Optional number of checkpoints for checkpointing-based differentiation. Needs to be provided for checkpointing gradient computation. Defaults to None.