Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-347

RandAugment Sampled Ops

Problem

Sample a RandAugment policy for one image.

Seed the random module, then draw num_layers operations with randrange(num_ops) and a magnitude index with randrange(num_magnitudes) for each. Return the list of [op_index, magnitude_index] pairs in application order.

Test cases

case 1
in: [4,2,3,0]
expected: [[3,1],[0,1]]
case 2
in: [4,2,3,1]
expected: [[1,2],[0,1]]
case 3
in: [10,3,5,42]
expected: [[1,0],[4,1],[3,1]]
case 4
in: [2,1,2,7]
expected: [[1,0]]
Starter codePython
def randaugment_ops(num_ops, num_layers, num_magnitudes, seed):
    # Your code here
    pass

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