Skip to content

forceschedule

Force schedule functions for driven DDPM diffusion models.

This module defines the base abstract class for force schedules and two concrete implementations that map a normalized time variable \(t \in [0,1]\) to a force scaling coefficient \(\alpha_{\mathrm{force}}(t)\).

Classes:

ForceSchedule

Bases: ABC

Abstract base class for force schedules.

Defines the interface for the time-dependent force scaling coefficient \(\alpha_{\mathrm{force}}(t)\) in driven DDPM models.

Methods:

alpha_force(t) abstractmethod

Compute the force scaling coefficient at time \(t\).

Parameters:

  • t ((array_like, shape(dim1))) –

    Normalized time steps, where \(t \in [0, 1]\).

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Force scaling coefficients.

Source code in src/fpsl/ddm/forceschedule.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@abstractmethod
def alpha_force(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Compute the force scaling coefficient at time $t$.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Normalized time steps, where $t \in [0, 1]$.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Force scaling coefficients.
    """
    raise NotImplementedError

LinearForceSchedule

Bases: ForceSchedule

Linearly fading force schedule.

Implements:

\[ \alpha_{\mathrm{force}}(t) = 1 - t \]

Methods:

  • alpha_force

    Returns \(1 - t\) for each time \(t\).

alpha_force(t)

Compute linearly fading force scaling.

Parameters:

  • t ((array_like, shape(dim1))) –

    Normalized time steps.

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Force scaling coefficients equal to \(1 - t\).

Source code in src/fpsl/ddm/forceschedule.py
78
79
80
81
82
83
84
85
86
87
88
89
90
91
def alpha_force(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Compute linearly fading force scaling.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Normalized time steps.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Force scaling coefficients equal to $1 - t$.
    """
    return 1 - t

ConstantForceSchedule

Bases: ForceSchedule

Constant force schedule.

Implements:

\[ \alpha_{\mathrm{force}}(t) = 1 \]

Methods:

alpha_force(t)

Compute constant force scaling.

Parameters:

  • t ((array_like, shape(dim1))) –

    Normalized time steps.

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Force scaling coefficients all equal to 1.

Source code in src/fpsl/ddm/forceschedule.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
def alpha_force(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Compute constant force scaling.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Normalized time steps.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Force scaling coefficients all equal to 1.
    """
    return jnp.ones_like(t)