All problems
ShuffleNet Channel Shuffle Index
Problem
Compute the channel shuffle permutation used by ShuffleNet.
Reshape the channel axis to (groups, channels // groups), transpose to (channels // groups, groups) and flatten; return the resulting index list. groups divides channels.
Test cases
case 1
in: [4,2]
expected: [0,2,1,3]
case 2
in: [6,3]
expected: [0,3,1,4,2,5]
case 3
in: [4,1]
expected: [0,1,2,3]
case 4
in: [8,4]
expected: [0,4,1,5,2,6,3,7]
Starter codePython
def channel_shuffle_indices(channels, groups):
# Your code here
pass4 test cases · run your code against them in the editor