Linear Noise Schedule
Implementation of a linear noise schedule for diffusion models.
LinearNoiseSchedule
¶
Bases: BaseNoiseSchedule
Linear noise schedule that increases linearly over time.
This class implements a simple linear noise schedule where the noise increases linearly from beta_min to beta_max over the diffusion process.
Source code in image_gen\noise\linear.py
__call__(t, *_, **__)
¶
Calculate noise at specific timesteps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
Tensor
|
Tensor containing timestep values in range [0, 1]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Tensor |
Tensor
|
Noise values corresponding to the input timesteps. |
Source code in image_gen\noise\linear.py
__init__(*_, beta_min=0.0001, beta_max=20.0, **__)
¶
Initialize the linear noise schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beta_min
|
float
|
Minimum noise value at t=0. Defaults to 0.0001. |
0.0001
|
beta_max
|
float
|
Maximum noise value at t=1. Defaults to 20.0. |
20.0
|
Source code in image_gen\noise\linear.py
config()
¶
Get the configuration parameters of the noise schedule.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary containing the configuration parameters. |
integral_beta(t, *_, **__)
¶
Calculate the integral of the noise function up to timestep t.
The analytical solution for the integral of a linear function from 0 to t is: beta_min * t + 0.5 * (beta_max - beta_min) * t^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
Tensor
|
Tensor containing timestep values in range [0, 1]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Tensor |
Tensor
|
Integrated noise values corresponding to the input timesteps. |