Skip to content
DeepForgeby svx
All problems

PPO Minibatch Epochs

Problem

Compute the total number of gradient updates in a PPO iteration: ceil(batch_size / minibatch_size) minibatches per epoch times the number of epochs. A non-positive minibatch size returns 0.

Hint

The last minibatch is kept even when the batch does not divide evenly.

Test cases

case 1
in: [64,16,4]
expected: 16
case 2
in: [100,32,3]
expected: 12
case 3
in: [10,10,1]
expected: 1
case 4
in: [10,0,5]
expected: 0
Starter codePython
import math
def ppo_minibatch_updates(batch_size, minibatch_size, epochs):
    # Your code here
    pass

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