Skip to content

Commit 1c45ec9

Browse files
bottlerfacebook-github-bot
authored andcommitted
Avoid gradients when rendering for visualization
Summary: The renderer gets used for visualization only in places. Here we avoid creating an autograd graph during that, which is not needed and can fail because some of the graph which existed earlier might be needed and has not been retained after the optimizer step. See #624 Reviewed By: gkioxari Differential Revision: D27593018 fbshipit-source-id: 62ae7a5a790111273aa4c566f172abd36c844bfb
1 parent 42016bc commit 1c45ec9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/tutorials/fit_textured_mesh.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@
455455
" target_image=target_rgb[1], title='', \n",
456456
" silhouette=False):\n",
457457
" inds = 3 if silhouette else range(3)\n",
458-
" predicted_images = renderer(predicted_mesh)\n",
458+
" with torch.no_grad():\n",
459+
" predicted_images = renderer(predicted_mesh)\n",
459460
" plt.figure(figsize=(20, 10))\n",
460461
" plt.subplot(1, 2, 1)\n",
461462
" plt.imshow(predicted_images[0, ..., inds].cpu().detach().numpy())\n",

0 commit comments

Comments
 (0)