Skip to content
DeepForgeby svx
All problems

Gradient Steps Per Env Step

Problem

Compute the number of gradient steps per environment step: epochs * (buffer_size / batch_size) / env_steps. A non-positive batch size or env step count returns 0.0.

Hint

This is just the replay ratio expressed through epochs over the buffer.

Test cases

case 1
in: [2,1000,100,100]
expected: 0.2
case 2
in: [1,500,50,100]
expected: 0.1
case 3
in: [4,64,32,8]
expected: 1
case 4
in: [1,100,0,10]
expected: 0
Starter codePython
def gradient_steps_per_env_step(epochs, buffer_size, batch_size, env_steps):
    # Your code here
    pass

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