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

Change NDArray.toString() output #1142

Merged
merged 3 commits into from
Aug 5, 2021
Merged

Conversation

frankfliu
Copy link
Contributor

Change-Id: I4c0b29e56fd6ed214656cf2681337e595ecda4e3

Description

Brief description of what this PR is about

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

@codecov-commenter
Copy link

codecov-commenter commented Aug 4, 2021

Codecov Report

Merging #1142 (04b891f) into master (e0aaa4b) will increase coverage by 0.04%.
The diff coverage is 60.60%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1142      +/-   ##
============================================
+ Coverage     70.12%   70.16%   +0.04%     
- Complexity     5329     5332       +3     
============================================
  Files           513      513              
  Lines         23696    23687       -9     
  Branches       2545     2546       +1     
============================================
+ Hits          16617    16621       +4     
+ Misses         5722     5707      -15     
- Partials       1357     1359       +2     
Impacted Files Coverage Δ
...ne/src/main/java/ai/djl/dlr/engine/DlrNDArray.java 35.29% <0.00%> (+3.71%) ⬆️
...st/src/main/java/ai/djl/ml/xgboost/XgbNDArray.java 59.61% <0.00%> (+4.25%) ⬆️
...ain/java/ai/djl/onnxruntime/engine/OrtNDArray.java 36.58% <0.00%> (+2.49%) ⬆️
...ain/java/ai/djl/paddlepaddle/engine/PpNDArray.java 50.00% <0.00%> (+4.76%) ⬆️
.../main/java/ai/djl/tflite/engine/TfLiteNDArray.java 36.61% <0.00%> (+2.40%) ⬆️
...rc/main/java/ai/djl/ndarray/internal/NDFormat.java 81.62% <63.63%> (-2.29%) ⬇️
api/src/main/java/ai/djl/ndarray/NDArray.java 75.72% <100.00%> (+0.14%) ⬆️
...e/src/main/java/ai/djl/mxnet/engine/MxNDArray.java 86.72% <100.00%> (ø)
...src/main/java/ai/djl/pytorch/engine/PtNDArray.java 80.69% <100.00%> (-0.05%) ⬇️
.../main/java/ai/djl/tensorflow/engine/TfNDArray.java 84.34% <100.00%> (ø)
... and 2 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 e0aaa4b...04b891f. Read the comment docs.

api/src/main/java/ai/djl/ndarray/internal/NDFormat.java Outdated Show resolved Hide resolved
* @return the debug string representation of this {@code NDArray}
*/
default String toDebugString() {
int maxSize = Integer.getInteger("ai.djl.nd_display_limit", 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes the default maxSize 0, which means it won't show any NDArrays. We should probably have a larger default to allow some to be displayed. Maybe 100 like MxNDarray before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, toString() is called by default in debugger, retrieving the data makes the debugger very slow. The default should be 0. User can manually configure debugger to use toDebugString() when then expend the data view, this will be on-demand and won't impact performance.

We display the content mostly in Jupyter notebook, I'm consider add the property in the IJava kernel to workaround this issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would also affect println statements as well. Here is another option. What if we added something like this check to see if the JVM is running in debug mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we won't print ndarray content in debugger

frankfliu and others added 3 commits August 4, 2021 15:57
Change-Id: I4c0b29e56fd6ed214656cf2681337e595ecda4e3
Co-authored-by: Zach Kimberg <zachary@kimberg.com>
Change-Id: Icf10106d24553510084996444db7657734bb9f80
@frankfliu frankfliu merged commit 8a393c0 into deepjavalibrary:master Aug 5, 2021
@frankfliu frankfliu deleted the nd branch August 5, 2021 19:02
Lokiiiiii pushed a commit to Lokiiiiii/djl that referenced this pull request Oct 10, 2023
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.

3 participants