mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
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 https://github.com/facebookresearch/pytorch3d/issues/624 Reviewed By: gkioxari Differential Revision: D27593018 fbshipit-source-id: 62ae7a5a790111273aa4c566f172abd36c844bfb
This commit is contained in:
parent
42016bc067
commit
1c45ec9770
@ -455,7 +455,8 @@
|
||||
" target_image=target_rgb[1], title='', \n",
|
||||
" silhouette=False):\n",
|
||||
" inds = 3 if silhouette else range(3)\n",
|
||||
" predicted_images = renderer(predicted_mesh)\n",
|
||||
" with torch.no_grad():\n",
|
||||
" predicted_images = renderer(predicted_mesh)\n",
|
||||
" plt.figure(figsize=(20, 10))\n",
|
||||
" plt.subplot(1, 2, 1)\n",
|
||||
" plt.imshow(predicted_images[0, ..., inds].cpu().detach().numpy())\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user