torchcell.losses.dango.LinearUntilFlipped

class LinearUntilFlipped(transition_epoch: int = 20)[source]

Bases: DangoLossSched

Schedule that linearly transitions from reconstruction-focused to interaction-focused.

Parameters:

transition_epoch – Epoch at which the transition completes (fully flipped to interaction loss)

forward(recon_loss: Tensor, interaction_loss: Tensor, current_epoch: int = 0) → tuple[Tensor, float, Tensor, Tensor][source]

Compute loss with a linear transition from recon loss to interaction loss.

Alpha linearly decreases from 1.0 (reconstruction only) to 0.0 (interaction only) over transition_epoch epochs.