Skip to content

Commit a343cf5

Browse files
nikhilaravifacebook-github-bot
authored andcommitted
Small fix to tutorial
Summary: Small fix to `fit_textured_mesh.ipynb` tutorial due to a recent change in numpy Reviewed By: bottler Differential Revision: D29219990 fbshipit-source-id: f5feeef9eb952720ea7154d066795fbbe64ce7a1
1 parent 029a9da commit a343cf5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

docs/tutorials/deform_source_mesh_to_target_mesh.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@
406406
" loop.set_description('total_loss = %.6f' % loss)\n",
407407
" \n",
408408
" # Save the losses for plotting\n",
409-
" chamfer_losses.append(loss_chamfer)\n",
410-
" edge_losses.append(loss_edge)\n",
411-
" normal_losses.append(loss_normal)\n",
412-
" laplacian_losses.append(loss_laplacian)\n",
409+
" chamfer_losses.append(float(loss_chamfer.detach().cpu()))\n",
410+
" edge_losses.append(float(loss_edge.detach().cpu()))\n",
411+
" normal_losses.append(float(loss_normal.detach().cpu()))\n",
412+
" laplacian_losses.append(float(loss_laplacian.detach().cpu()))\n",
413413
" \n",
414414
" # Plot mesh\n",
415415
" if i % plot_period == 0:\n",

docs/tutorials/fit_textured_mesh.ipynb

+5-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"id": "okLalbR_g7NS"
4747
},
4848
"source": [
49-
"Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
50-
]
49+
"Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
50+
]
5151
},
5252
{
5353
"cell_type": "code",
@@ -645,7 +645,8 @@
645645
" sum_loss = torch.tensor(0.0, device=device)\n",
646646
" for k, l in loss.items():\n",
647647
" sum_loss += l * losses[k][\"weight\"]\n",
648-
" losses[k][\"values\"].append(l)\n",
648+
" losses[k][\"values\"].append(float(l.detach().cpu()))\n",
649+
"\n",
649650
" \n",
650651
" # Print the losses\n",
651652
" loop.set_description(\"total_loss = %.6f\" % sum_loss)\n",
@@ -829,7 +830,7 @@
829830
" sum_loss = torch.tensor(0.0, device=device)\n",
830831
" for k, l in loss.items():\n",
831832
" sum_loss += l * losses[k][\"weight\"]\n",
832-
" losses[k][\"values\"].append(l)\n",
833+
" losses[k][\"values\"].append(float(l.detach().cpu()))\n",
833834
" \n",
834835
" # Print the losses\n",
835836
" loop.set_description(\"total_loss = %.6f\" % sum_loss)\n",

0 commit comments

Comments
 (0)