Unflattens a tensor dim expanding it to a desired shape. For use with [nn_sequential.
Source:R/nn-flatten.R
nn_unflatten.Rd
Unflattens a tensor dim expanding it to a desired shape. For use with [nn_sequential.
Examples
if (torch_is_installed()) {
input <- torch_randn(2, 50)
m <- nn_sequential(
nn_linear(50, 50),
nn_unflatten(2, c(2, 5, 5))
)
output <- m(input)
output$size()
}
#> [1] 2 2 5 5