mindspore.ops.channel_shuffle
- mindspore.ops.channel_shuffle(x, groups)[源代码]
将shape为
的tensor的通道划分成 组,并按如下方式重新排列 ,同时在最终输出中保持原始tensor的shape。- 参数:
x (Tensor) - 输入tensor。
groups (int) - 通道划分数目。
- 返回:
Tensor
- 支持平台:
Ascend
CPU
样例:
>>> import mindspore >>> x = mindspore.tensor(mindspore.ops.arange(0, 16, dtype=mindspore.int16).reshape(1, 4, 2, 2)) >>> y = mindspore.ops.channel_shuffle(x, groups=2) >>> print(y) [[[[ 0 1] [ 2 3]] [[ 8 9] [10 11]] [[ 4 5] [ 6 7]] [[12 13] [14 15]]]]