# NOT RUN {
if (torch_is_installed()) {
loss <- nn_poisson_nll_loss()
log_input <- torch_randn(5, 2, requires_grad=TRUE)
target <- torch_randn(5, 2)
output <- loss(log_input, target)
output$backward()
}
# }
Run the code above in your browser using DataLab