# NOT RUN {
if (torch_is_installed()) {
x = torch_tensor(matrix(c(1:9), ncol = 3, byrow= TRUE))
torch_narrow(x, 1, torch_tensor(0L)$sum(dim = 1), 2)
torch_narrow(x, 2, torch_tensor(1L)$sum(dim = 1), 2)
}
# }
Run the code above in your browser using DataLab