Channel_shuffle
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_channel_shuffle.Rd
Channel_shuffle
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_tensor
#> (1,1,.,.) =
#> 0.01 *
#> 7.3356 -174.6643
#> -58.0814 -94.0913
#>
#> (1,2,.,.) =
#> -1.9080 -0.0760
#> -0.3699 1.2992
#>
#> (1,3,.,.) =
#> -0.1018 -0.3375
#> 0.4146 1.3945
#>
#> (1,4,.,.) =
#> 0.4264 0.7439
#> 0.2286 -0.2788
#> [ CPUFloatType{1,4,2,2} ]
#> torch_tensor
#> (1,1,.,.) =
#> 0.01 *
#> 7.3356 -174.6643
#> -58.0814 -94.0913
#>
#> (1,2,.,.) =
#> -0.1018 -0.3375
#> 0.4146 1.3945
#>
#> (1,3,.,.) =
#> -1.9080 -0.0760
#> -0.3699 1.2992
#>
#> (1,4,.,.) =
#> 0.4264 0.7439
#> 0.2286 -0.2788
#> [ CPUFloatType{1,4,2,2} ]