torch_channel_shuffle: Channel_shuffle

View source: R/gen-namespace.R

torch_channel_shuffleR Documentation

Channel_shuffle

Description

Channel_shuffle

Usage

torch_channel_shuffle(self, groups)

Arguments

self

(Tensor) the input tensor

groups

(int) number of groups to divide channels in and rearrange.

Divide the channels in a tensor of shape

math:⁠(*, C , H, W)⁠ :

Divide the channels in a tensor of shape (*, C , H, W) into g groups and rearrange them as (*, C \frac g, g, H, W), while keeping the original tensor shape.

Examples

if (torch_is_installed()) {

input <- torch_randn(c(1, 4, 2, 2))
print(input)
output <- torch_channel_shuffle(input, 2)
print(output)
}

torch documentation built on June 7, 2023, 6:19 p.m.