Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead

maybe you can put with torch.no_grad(): before your code, and try again

1 Like