-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added utility to automatically check jacobians of a given cost function. #465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy this function and run it in my local Jupyter, with 0.1.4 version of theseus. An error occurs in Line 153, showing "property' object is not iterable"
Besides, should Line 154 be aux_var = list(cf.aux_vars)
?
Good catch, fixed this in 1a0047b. Can you post a screen shot of the error you are getting? I wrote a unit test for this code and it seems to be working will with our existing cost functions. |
|
Ah, I see. The error is that you are directly passing the class, but this method requires passing a class instance. I do think passing the class would be more intuitive, but it will unfortunately make the code much more complicated, because there is currently no easy way to get the information about the variable types just from the class. I thought for a bit about adding this, but I think it would this PR more large and complicated, so decided to keep as is for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! If we want to add improvements like you mention then we can flag an issue to switch to passing class name instead of an instance.
I am not sure we should enable some check for the full objective since it would slow down the construction with unnecessary checks especially if there are many cost functions of the same type in the objective or check cost functions in the library that are already verified in unit tests. Could we assume a user would just use this function adhoc when they need it for their custom cost functions?
I'll at least add a method one can run on the full objective on-demand, even if it's slow. I think this would be the most convenient API for this feature. |
1a0047b
to
3851a71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! On demand checks is a good compromise than always silently running the checks under the hood.
Closes #321.
Not integrated with
TheseusLayer
yet, but I think we can set this up so that the check is (optionally) performed once for each cost function right after the objective's version is fixed.cc @xphsean12 as related to #461