stannum icon indicating copy to clipboard operation
stannum copied to clipboard

Proxy `torch.nn.Parameter` for PyTorch optimizers

Open ifsheldon opened this issue 3 years ago • 2 comments
trafficstars

Now Tin and Tube are subclasses of torch.nn.Module and they can have learnable parameters in the form of values in Taichi fields. However, now these values cannot be optimized by PyTorch optimizers, since they are not PyTorch-compatible. One way to make them to be PyTorch-compatible is to use a proxy torch.nn.Parameter and sync the values of torch.nn.Parameter with those in the corresponding Taichi field.

If anyone come up with a better solution, discussions and PRs are always welcomed.

ifsheldon avatar Dec 30 '21 19:12 ifsheldon

Hi! I'm hoping to try doing RL with difftaichi and stannum. Any update on this issue?

rdesc avatar Oct 24 '23 22:10 rdesc

Hi @rdesc ! I'm sorry, I have little time to work on this. If you can make a PR, I will be happy to review it.

ifsheldon avatar Oct 25 '23 06:10 ifsheldon