Channel_shuffle
Source:R/gen-namespace-docs.R, R/gen-namespace-examples.R, R/gen-namespace.R
torch_channel_shuffle.RdChannel_shuffle
Divide the channels in a tensor of shape
math:(*, C , H, W) :
Divide the channels in a tensor of 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,.,.) =
#> 2.2912 -2.6283
#> 1.5552 0.3406
#>
#> (1,2,.,.) =
#> -0.6944 0.1834
#> -1.9672 1.8651
#>
#> (1,3,.,.) =
#> 1.7977 -0.4962
#> -0.6441 0.4838
#>
#> (1,4,.,.) =
#> -0.3788 -0.2935
#> 0.2241 0.7408
#> [ CPUFloatType{1,4,2,2} ]
#> torch_tensor
#> (1,1,.,.) =
#> 2.2912 -2.6283
#> 1.5552 0.3406
#>
#> (1,2,.,.) =
#> 1.7977 -0.4962
#> -0.6441 0.4838
#>
#> (1,3,.,.) =
#> -0.6944 0.1834
#> -1.9672 1.8651
#>
#> (1,4,.,.) =
#> -0.3788 -0.2935
#> 0.2241 0.7408
#> [ CPUFloatType{1,4,2,2} ]