Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-286

Structured Pruning Channel Selection

Problem

Select the channels to keep when pruning by filter norm.

Keep the indices of the `keep` largest channel norms, returning them sorted ascending. Ties keep the smaller index. Return [] when keep is 0.

Test cases

case 1
in: [[0.5,2,1,3],2]
expected: [1,3]
case 2
in: [[0.5,2,1,3],0]
expected: []
case 3
in: [[0.5,2,1,3],4]
expected: [0,1,2,3]
case 4
in: [[1,1,2],2]
expected: [0,2]
Starter codePython
def prune_channels(channel_norms, keep):
    # Your code here
    pass

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