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

[BugFix] Fix breaking behaviour in 0.18.0 #1801

Merged

Conversation

KexinFeng
Copy link
Contributor

Description

This fixes issue.

The fix is to allow other datatype of index than just integer. The dataType conversion to Long has already implemented before in JniUtils

@@ -373,7 +373,7 @@ private int addIndexItem(String indexItem, int argIndex, Object[] args) {
if (array.getDataType() == DataType.BOOLEAN) {
indices.add(new NDIndexBooleans(array));
return argIndex + 1;
} else if (array.getDataType().isInteger()) {
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this cause issues if DataType is UNKNOWN or STRING? https://github.com/deepjavalibrary/djl/blob/master/api/src/main/java/ai/djl/ndarray/types/DataType.java#L28-L34 seems like what we need to cover in this code, and not UNKNOWN or STRING

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this. I'll update it.

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #1801 (106e21e) into master (bb5073f) will decrease coverage by 2.48%.
The diff coverage is 65.13%.

@@             Coverage Diff              @@
##             master    #1801      +/-   ##
============================================
- Coverage     72.08%   69.60%   -2.49%     
- Complexity     5126     5493     +367     
============================================
  Files           473      524      +51     
  Lines         21970    24318    +2348     
  Branches       2351     2645     +294     
============================================
+ Hits          15838    16927    +1089     
- Misses         4925     6081    +1156     
- Partials       1207     1310     +103     
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% <ø> (-5.24%) ⬇️
...odality/cv/translator/BigGANTranslatorFactory.java 33.33% <0.00%> (+8.33%) ⬆️
...nslator/InstanceSegmentationTranslatorFactory.java 14.28% <0.00%> (-3.90%) ⬇️
.../cv/translator/SemanticSegmentationTranslator.java 0.00% <0.00%> (ø)
.../cv/translator/StyleTransferTranslatorFactory.java 40.00% <ø> (ø)
... and 414 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cea6f94...106e21e. Read the comment docs.

@KexinFeng KexinFeng merged commit 3bc3689 into deepjavalibrary:master Jul 15, 2022
KexinFeng added a commit to KexinFeng/djl that referenced this pull request Jul 22, 2022
NDIndex tests of float index are also added.
@KexinFeng KexinFeng deleted the Fix_breaking_behavior_in_0.18.0_ branch August 25, 2022 00:15
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.

NDArray.get(NDArray) breaking behavior in 0.18.0
4 participants