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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions python/cudf/cudf/_lib/interop.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

import cudf
import warnings

from cudf._lib.table cimport Table
from libcpp.vector cimport vector
Expand Down Expand Up @@ -32,10 +31,6 @@ def from_dlpack(dlpack_capsule):

DLPack Tensor PyCapsule is expected to have the name "dltensor".
"""
warnings.warn("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.")

cdef DLManagedTensor* dlpack_tensor = <DLManagedTensor*>pycapsule.\
PyCapsule_GetPointer(dlpack_capsule, 'dltensor')
pycapsule.PyCapsule_SetName(dlpack_capsule, 'used_dltensor')
Expand All @@ -61,11 +56,6 @@ def to_dlpack(Table source_table):

DLPack Tensor PyCapsule will have the name "dltensor".
"""

warnings.warn("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.")

for column in source_table._columns:
if column.null_count:
raise ValueError(
Expand Down
16 changes: 13 additions & 3 deletions python/cudf/cudf/io/dlpack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019, NVIDIA CORPORATION.
# Copyright (c) 2019-2020, NVIDIA CORPORATION.

from cudf._lib import interop as libdlpack
from cudf.core.column import ColumnBase
Expand Down Expand Up @@ -28,6 +28,11 @@ def from_dlpack(pycapsule_obj):
-------
A cuDF DataFrame or Series depending on if the input DLPack tensor is 1D
or 2D.

Notes
-----
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)
Expand All @@ -46,8 +51,8 @@ def to_dlpack(cudf_obj):
`dmlc/dlpack <https://github.com/dmlc/dlpack>`_.

This function takes a cuDF object as input, and returns a PyCapsule object
which contains a pointer to DLPack tensor. This function deep
copies the data in the cuDF object into the DLPack tensor.
which contains a pointer to DLPack tensor. This function deep copies
the data in the cuDF object into the DLPack tensor.

Parameters
----------
Expand All @@ -57,6 +62,11 @@ def to_dlpack(cudf_obj):
Returns
-------
A DLPack tensor pointer which is encapsulated in a PyCapsule object.

Notes
-----
cuDF to_dlpack() produces column-major (Fortran order) output. If the
output tensor needs to be row major, transpose the output of this function.
"""
if len(cudf_obj) == 0:
raise ValueError("Cannot create DLPack tensor of 0 size")
Expand Down