Group Shuffle
Group Conv
Channel Shuffle
Details could be checked here.
https://github.com/mindspore-lab/mindcv/blob/main/mindcv/models/shufflenetv1.py
def channel_shuffle(self, x: Tensor) -> Tensor:
batch_size, num_channels, height, width = x.shape
group_channels = num_channels // self.group
x = ops.reshape(x, (batch_size, group_channels, self.group, height, width))
x = ops.transpose(x, (0, 2, 1, 3, 4))
x = ops.reshape(x, (batch_size, num_channels, height, width))
return x
Memory Layout
123 456 789 (3 groups)
reordered as
147 258 369
assuming num_channels % self.group != 0
here.
Last modified: 10 March 2024