Skip to content
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

Merged
merged 3 commits into from Sep 30, 2022

Conversation

zachgk
Copy link
Contributor

@zachgk zachgk commented Sep 28, 2022

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.

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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-commenter
Copy link

codecov-commenter commented Sep 28, 2022

Codecov Report

Base: 72.08% // Head: 69.72% // Decreases project coverage by -2.36% ⚠️

Coverage data is based on head (cd853f7) compared to base (bb5073f).
Patch coverage: 68.39% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
api/src/main/java/ai/djl/modality/cv/Image.java 69.23% <ø> (-4.11%) ⬇️
...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java 76.00% <ø> (ø)
...rc/main/java/ai/djl/modality/cv/output/Joints.java 71.42% <ø> (ø)
.../main/java/ai/djl/modality/cv/output/Landmark.java 100.00% <ø> (ø)
...main/java/ai/djl/modality/cv/output/Rectangle.java 72.41% <0.00%> (ø)
...i/djl/modality/cv/translator/BigGANTranslator.java 21.42% <0.00%> (-5.24%) ⬇️
...odality/cv/translator/BigGANTranslatorFactory.java 33.33% <0.00%> (+8.33%) ⬆️
.../cv/translator/InstanceSegmentationTranslator.java 0.00% <0.00%> (-86.59%) ⬇️
...nslator/InstanceSegmentationTranslatorFactory.java 7.14% <0.00%> (-11.04%) ⬇️
.../cv/translator/SemanticSegmentationTranslator.java 0.00% <0.00%> (ø)
... and 513 more

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

*
* @return the parameter that was not initialized
*/
public Parameter getParameter() {
Copy link
Contributor

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?

@zachgk zachgk merged commit 72d00a0 into deepjavalibrary:master Sep 30, 2022
@zachgk zachgk deleted the noInitializeChildBlock branch September 30, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants