Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-100

Micro-Batch Count

Problem

Compute the number of micro-batches needed to cover a dataset: ceil(dataset_size / batch_size).

The signature is micro_batch_count(dataset_size, batch_size). Return an integer.

Hint

Add batch_size - 1 before the integer division to round up.

Test cases

case 1
in: [1000,10]
expected: 100
case 2
in: [1001,10]
expected: 101
case 3
in: [0,10]
expected: 0
case 4
in: [7,3]
expected: 3
Starter codePython
def micro_batch_count(dataset_size, batch_size):
    # Your code here
    pass

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