Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-142

Linear Beta Schedule

Problem

Build the linear diffusion noise schedule: beta_t = beta_start + (beta_end - beta_start) * t / (timesteps - 1) for t from 0 to timesteps - 1.

The signature is linear_beta_schedule(beta_start, beta_end, timesteps). Return the list of betas.

Hint

The first and last timesteps hit beta_start and beta_end exactly.

Test cases

case 1
in: [0.0001,0.02,5]
expected: [0.0001,0.005075,0.01005,0.015025,0.02]
case 2
in: [0,1,3]
expected: [0,0.5,1]
case 3
in: [0.1,0.1,4]
expected: [0.1,0.1,0.1,0.1]
case 4
in: [0,0.8,4]
expected: [0,0.2666666667,0.5333333333,0.8]
Starter codePython
def linear_beta_schedule(beta_start, beta_end, timesteps):
    # Your code here
    pass

4 test cases · run your code against them in the editor