Hi Justin!



 lelouedec:


seed_nb = torch.tensor(600,device = pyredner.get_device(), requires_grad=True)

The problem is that I want the variable “seed_nb” to be differentiable/learned to be the right value when back-propagating.


There is no straightforward way to do what you want.  The problem is
that the number of points on your sphere is an integer and there is no
sensible way to differentiate with respect to an integer.
Helpfully, pytorch won’t let you do this:
>>> import torch
>>> torch.__version__
'1.9.0'
>>> torch.tensor (600, device = 'cpu', requires_grad = True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Only Tensors of floating point and complex dtype can require gradients

Best.
K. Frank