Skip to content

Commit

Permalink
Make doctest resilient to changes in cupy reprs (#4945)
Browse files Browse the repository at this point in the history
Depending on the cupy package in use (varies by version, architecture, etc) the exact name of the `ndarray` object may be `cupy.ndarray` or something like `cupy._core.core.ndarray` instead. Using `isinstance` avoids doctest failures due to those sorts of instabilities.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - William Hicks (https://github.com/wphicks)

URL: #4945
  • Loading branch information
vyasr authored Oct 26, 2022
1 parent d2d8065 commit 921b5ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/cuml/common/memory_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ def using_output_type(output_type):
>>> # cuML default output
>>> dbscan_float2.labels_
array([0, 1, 2], dtype=int32)
>>> type(dbscan_float2.labels_)
<class 'cupy.ndarray'>
>>> isinstance(dbscan_float2.labels_, cp.ndarray)
True
"""
prev_output_type = cuml.global_settings.output_type
Expand Down

0 comments on commit 921b5ee

Please sign in to comment.