-
Notifications
You must be signed in to change notification settings - Fork 655
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
Handle error when forget to initialize a child block #2045
Conversation
This throws an error with a much clearer error message in case someone fails to initialize a child block. It should help greatly reduce the time it takes to debug the error in this situation.
package ai.djl.nn; | ||
|
||
/** Thrown to indicate that a {@link Parameter} was not initialized. */ | ||
public class UninitializeParameterException extends RuntimeException { |
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.
nit: Should this be UninitializedParameterException?
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.
It should. Good catch
Codecov ReportBase: 72.08% // Head: 69.72% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2045 +/- ##
============================================
- Coverage 72.08% 69.72% -2.37%
- Complexity 5126 5984 +858
============================================
Files 473 600 +127
Lines 21970 26536 +4566
Branches 2351 2883 +532
============================================
+ Hits 15838 18503 +2665
- Misses 4925 6648 +1723
- Partials 1207 1385 +178
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
* | ||
* @return the parameter that was not initialized | ||
*/ | ||
public Parameter getParameter() { |
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.
Where this method is used?
Parameter contains NDArray, at place this is referenced, it may already get closed.
Can we just generate the message include parameter information instead of passing the Parameter to the exception?
This throws an error with a much clearer error message in case someone fails to initialize a child block. It should help greatly reduce the time it takes to debug the error in this situation.