Skip to content

Commit

Permalink
[doc] Autodiff: fix typo + add reference to torch example script
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinND committed Mar 3, 2020
1 parent 5369370 commit f3cfafc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/inverse_rendering/diff_render.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ samples per pixel (``spp``).
.. code-block:: python
# Render a reference image (no derivatives used yet)
from mitsuba.python.autodiff import render, render, write_bitmap
from mitsuba.python.autodiff import render, write_bitmap
image_ref = render(scene, spp=8)
crop_size = scene.sensors()[0].film().crop_size()
write_bitmap('out_ref.png', image_ref, crop_size)
Expand Down Expand Up @@ -261,6 +261,7 @@ gradient steps.

.. code-block:: python
# for loop body (continued)
# Objective: MSE between 'image' and 'image_ref'
ob_val = ek.hsum(ek.sqr(image - image_ref)) / len(image)
Expand Down
5 changes: 5 additions & 0 deletions docs/src/inverse_rendering/pytorch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,8 @@ The main optimization loop looks as follows:
# Compare iterate against ground-truth value
err_ref = objective(params_torch['red.reflectance.value'], param_ref)
print('Iteration %03i: error=%g' % (it, err_ref * 3))
.. note::

The full Python script of this tutorial can be found in the file:
:file:`docs/examples/10_diff_render/invert_cbox_torch.py`.

0 comments on commit f3cfafc

Please sign in to comment.