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

Remove warning in from_dlpack and to_dlpack methods #7001

Merged
merged 6 commits into from
Dec 14, 2020
Merged

Remove warning in from_dlpack and to_dlpack methods #7001

merged 6 commits into from
Dec 14, 2020

Conversation

miguelusque
Copy link
Member

@miguelusque miguelusque commented Dec 13, 2020

Fix #6926 .

Hi!

When invoking from_dlpack() and to_dlpack, the following warnings are displayed:

from_dlpack()

/opt/conda/envs/rapids/lib/python3.7/site-packages/cudf/io/dlpack.py:33: UserWarning: WARNING: cuDF from_dlpack() assumes column-major (Fortran order) input. If the input tensor is row-major, transpose it before passing it to this function.
res = libdlpack.from_dlpack(pycapsule_obj)

to_dlpack()

/opt/conda/envs/rapids/lib/python3.7/site-packages/cudf/io/dlpack.py:74: UserWarning: WARNING: cuDF to_dlpack() produces column-major (Fortran order) output. If the output tensor needs to be row major, transpose the output of this function.
return libdlpack.to_dlpack(gdf_cols)

I think those warnings should be removed, because it contains information that should be available in the API documentation, and not necessarily displayed each time the methods are invoked.

Some users, like me, love to have their notebooks/code without warnings. Even if it is possible to disable those warnings, I think the user should not go that way, because the warning is just repeating what the API documentation should cover.

Hope it helps!
Miguel

Fix #6926 .

Hi,

Hi!

When invoking from_dlpack() and to_dlpack, the following warnings are displayed:

from_dlpack()

/opt/conda/envs/rapids/lib/python3.7/site-packages/cudf/io/dlpack.py:33: UserWarning: WARNING: cuDF from_dlpack() assumes column-major (Fortran order) input. If the input tensor is row-major, transpose it before passing it to this function.
res = libdlpack.from_dlpack(pycapsule_obj)
to_dlpack()

/opt/conda/envs/rapids/lib/python3.7/site-packages/cudf/io/dlpack.py:74: UserWarning: WARNING: cuDF to_dlpack() produces column-major (Fortran order) output. If the output tensor needs to be row major, transpose the output of this function.
return libdlpack.to_dlpack(gdf_cols)
I think those warnings should be removed, because it contains information that should be available in the API documentation, and not necessarily displayed each time the methods are invoked.

Some users, like me, love to have their notebooks/code without warnings. Even if it is possible to disable those warnings, I think the user should not go that way, because the warning is just repeating what the API documentation should cover.

Hope it helps!
Miguel
@codecov
Copy link

codecov bot commented Dec 13, 2020

Codecov Report

Merging #7001 (da6d649) into branch-0.18 (929c3f4) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           branch-0.18    #7001   +/-   ##
============================================
  Coverage        82.01%   82.01%           
============================================
  Files               96       96           
  Lines            16338    16340    +2     
============================================
+ Hits             13400    13402    +2     
  Misses            2938     2938           
Impacted Files Coverage Δ
python/cudf/cudf/io/dlpack.py 95.23% <ø> (ø)
python/cudf/cudf/core/column/numerical.py 94.56% <0.00%> (+0.02%) ⬆️

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 929c3f4...da6d649. Read the comment docs.

Copy link
Contributor

@galipremsagar galipremsagar left a comment

Choose a reason for hiding this comment

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

Can we add the warnings being removed in both of the from_dlpack & to_dlpack under notes in pydocs here: https://github.com/rapidsai/cudf/blob/598a14d820d47b7c3bfcb2bb3341b97a85317646/python/cudf/cudf/io/dlpack.py

@galipremsagar galipremsagar added 0 - Waiting on Author Waiting for author to respond to review Python Affects Python cuDF API. doc Documentation improvement Improvement / enhancement to an existing function non-breaking Non-breaking change and removed Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function labels Dec 14, 2020
Moved API documentation from warning message to API doc.
@miguelusque
Copy link
Member Author

Thank you for your review @galipremsagar. I have just added the requested comments accordingly.

Removed trailing space and reduced the line length to <=80
I have just moved the warning to a NOTES section.
@galipremsagar galipremsagar removed the 0 - Waiting on Author Waiting for author to respond to review label Dec 14, 2020
@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge 6 - Okay to Auto-Merge labels Dec 14, 2020
Copy link
Contributor

@rgsl888prabhu rgsl888prabhu left a comment

Choose a reason for hiding this comment

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

Have to update copyright in python/cudf/cudf/io/dlpack.py

Updated copyright notice from 2019 to 2019-2020.
@rapids-bot rapids-bot bot merged commit a5515f2 into rapidsai:branch-0.18 Dec 14, 2020
@miguelusque miguelusque deleted the patch-3 branch December 15, 2020 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge doc Documentation non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Remove warnings at 'from_dlpack' and 'to_dlpack' methods
3 participants