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

Fix pylibraft docstring example code #980

Merged
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
6 changes: 4 additions & 2 deletions python/pylibraft/pylibraft/cluster/kmeans.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def compute_new_centroids(X,
import cupy as cp

from pylibraft.common import Handle
from pylibaft.cluster.kmeans import update_centroids
from pylibraft.cluster.kmeans import compute_new_centroids
from pylibraft.distance import fused_l2_nn_argmin

# A single RAFT handle can optionally be reused across
Expand All @@ -129,7 +129,9 @@ def compute_new_centroids(X,

new_centroids = cp.empty((n_clusters, n_features), dtype=cp.float32)

compute_new_centroids(X, centroids, new_centroids, handle=handle)
compute_new_centroids(
X, centroids, labels, new_centroids, handle=handle
)

# pylibraft functions are often asynchronous so the
# handle needs to be explicitly synchronized
Expand Down
2 changes: 1 addition & 1 deletion python/pylibraft/pylibraft/common/cuda.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cdef class Stream:

.. code-block:: python

from raft.common.cuda import Stream
from pylibraft.common.cuda import Stream
stream = Stream()
stream.sync()
del stream # optional!
Expand Down
2 changes: 1 addition & 1 deletion python/pylibraft/pylibraft/distance/fused_l2_nn.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def fused_l2_nn_argmin(X, Y, output, sqrt=True, handle=None):
import cupy as cp

from pylibraft.common import Handle
from pylibraft.distance import fused_l2_nn
from pylibraft.distance import fused_l2_nn_argmin

n_samples = 5000
n_clusters = 5
Expand Down