NeuroDiffGym / neurodiffeq

A library for solving differential equations using neural networks based on PyTorch, used by multiple research groups around the world, including at Harvard IACS.
http://pypi.org/project/neurodiffeq/
MIT License
682 stars 89 forks source link

Support computing grad w.r.t. multiple variables in one `diff` pass. #112

Closed shuheng-liu closed 3 years ago

shuheng-liu commented 3 years ago

Support usage like

grad_x, grad_y = diff(u, [x, y])

so that gradient of two variables can be computed in one pass.

shuheng-liu commented 3 years ago

Solved with 156e201. The newly implemented tool works like this:

from neurodiffeq.operators import grad

grad_x, grad_y, grad_z = grad(u, x, y, z)