# NOT RUN {
if (torch_is_installed()) {
pool <- nn_max_pool1d(2, stride=2, return_indices=TRUE)
unpool <- nn_max_unpool1d(2, stride=2)
input <- torch_tensor(array(1:8/1, dim = c(1,1,8)))
out <- pool(input)
unpool(out[[1]], out[[2]])
# Example showcasing the use of output_size
input <- torch_tensor(array(1:8/1, dim = c(1,1,8)))
out <- pool(input)
unpool(out[[1]], out[[2]], output_size=input$size())
unpool(out[[1]], out[[2]])
}
# }
Run the code above in your browser using DataLab