Comments (2)
Hi, thanks for raising the issue. This type of bugs usually occurs when a dependency on a variable disappear in the first grad. For example, if the function is f = a*x+b
, the derivative df/da=x
which does not depend on a
nor b
. In that case, taking the second derivative w.r.t. a
or b
will raise that error. The fix from the xitorch side is just to set allow_unused=False
, but you can also do a workaround by adding more dependency on the vars, e.g., f = a*x + b + a^2*0 + b^2*0
from xitorch.
Hello, thanks for your help, but I noticed that here dfdy somehow is related to V, since variables V in xitorch is used to calculated the dfdy, as realized in jachess:
Here for dfdy,
with torch.enable_grad():
yout = fcn(*params) # (*nout)
v = torch.ones_like(yout).to(yout.device).requires_grad_() # (*nout)
dfdy, = torch.autograd.grad(yout, (yparam,), grad_outputs=v, create_graph=True) # (*nin)
and for grad to v.
for i in range(nbatch):
dfdyf, = torch.autograd.grad(dfdy, (v,), grad_outputs=gy1[i].reshape(self.inshape),
retain_graph=True, create_graph=torch.is_grad_enabled()) # (*nout)
I cannot figure out why here the second derivative to v is unavailable. Since v is not explicit available to fcn function, adding dependencies seems difficult to conduct. Is there anything I can do for this?
Thanks again for helping!
from xitorch.
Related Issues (18)
- `torch.outer` is not yet present in pytorch HOT 1
- Incompatibility with pytorch 1.10 HOT 3
- Rootfinder fails with a simple case
- gradient-vector product and vector-gradient product for higher-order gradients
- Cannot install from sdist obtained from PyPI HOT 1
- Custom termination criterion for nonlinear solver HOT 2
- Interpolate module to-do list
- Status Badges issues
- Any way to improve the computational speed of the linalg.symeig() function? HOT 3
- Using root finder to solve a inverse function with the NN form Error HOT 1
- Linear algebra module to-do list HOT 1
- Integrate module to-do list
- Optimize module to-do list HOT 1
- Example 2 broken HOT 1
- Joint eigenvalues of a pair of matrix HOT 11
- Complex hermitian matrices not recognized as hermitian. HOT 2
- Spurious results if x input is not sorted in interpolate.Interp1D HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xitorch.