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,.,.) =
#> 1.0585 0.5546
#> 0.3276 -0.0299
#>
#> (1,2,.,.) =
#> -1.9318 1.7340
#> -1.8660 -0.0455
#>
#> (1,3,.,.) =
#> -1.3935 1.0309
#> -1.3772 -0.1257
#>
#> (1,4,.,.) =
#> -0.7952 0.0387
#> -0.1631 -0.3129
#> [ CPUFloatType{1,4,2,2} ]
#> torch_tensor
#> (1,1,.,.) =
#> 1.0585 0.5546
#> 0.3276 -0.0299
#>
#> (1,2,.,.) =
#> -1.3935 1.0309
#> -1.3772 -0.1257
#>
#> (1,3,.,.) =
#> -1.9318 1.7340
#> -1.8660 -0.0455
#>
#> (1,4,.,.) =
#> -0.7952 0.0387
#> -0.1631 -0.3129
#> [ CPUFloatType{1,4,2,2} ]