You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Splitting from #3567. Bug has got to do with interoperability of cuml's confusion matrix with torch arrays. However, testing for this is likely to go beyond just confusion matrix.
Adding to this bug:
Code:
from cuml.metrics import confusion_matrix
print(confusion_matrix(y_true=labels.type(dtype=torch.int32).to(device),
y_pred=pred.argmax(1).type(dtype=torch.int32).to(device)
))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-23-b32704b34c7b> in <module>
20
21 print(confusion_matrix(y_true=labels.type(dtype=torch.int32).to(device),
---> 22 y_pred=pred.argmax(1).type(dtype=torch.int32).to(device)))
/opt/conda/envs/rapids/lib/python3.7/site-packages/cuml/internals/api_decorators.py in inner_with_getters(*args, **kwargs)
464
465 # Call the function
--> 466 ret_val = func(*args, **kwargs)
467
468 return cm.process_return(ret_val)
/opt/conda/envs/rapids/lib/python3.7/site-packages/cuml/metrics/confusion_matrix.py in confusion_matrix(y_true, y_pred, labels, sample_weight, normalize)
67
68 if labels is None:
---> 69 labels = sorted_unique_labels(y_true, y_pred)
70 n_labels = len(labels)
71 else:
/opt/conda/envs/rapids/lib/python3.7/site-packages/cuml/metrics/utils.py in sorted_unique_labels(*ys)
22 labels."""
23 ys = (cp.unique(y) for y in ys)
---> 24 labels = cp.unique(cp.concatenate(ys))
25 return labels
/opt/conda/envs/rapids/lib/python3.7/site-packages/cupy/manipulation/join.py in concatenate(tup, axis, out)
55 tup = [m.ravel() for m in tup]
56 axis = 0
---> 57 return core.concatenate_method(tup, axis, out)
58
59
cupy/core/_routines_manipulation.pyx in cupy.core._routines_manipulation.concatenate_method()
cupy/core/_routines_manipulation.pyx in cupy.core._routines_manipulation.concatenate_method()
/opt/conda/envs/rapids/lib/python3.7/site-packages/cuml/metrics/utils.py in <genexpr>(.0)
21 """Extract an ordered array of unique labels from one or more arrays of
22 labels."""
---> 23 ys = (cp.unique(y) for y in ys)
24 labels = cp.unique(cp.concatenate(ys))
25 return labels
/opt/conda/envs/rapids/lib/python3.7/site-packages/cupy/manipulation/add_remove.py in unique(ar, return_index, return_inverse, return_counts, axis)
110 aux = ar[perm]
111 else:
--> 112 ar.sort()
113 aux = ar
114 mask = cupy.empty(aux.shape, dtype=cupy.bool_)
cupy/core/core.pyx in cupy.core.core.ndarray.sort()
cupy/core/core.pyx in cupy.core.core.ndarray.sort()
cupy/core/_routines_sorting.pyx in cupy.core._routines_sorting._ndarray_sort()
cupy/cuda/thrust.pyx in cupy.cuda.thrust.sort()
RuntimeError: radix_sort: failed on 1st step: cudaErrorInvalidDevice: invalid device ordinal
Code that does work by converting torch.tensor with .cpu():
from sklearn.metrics import confusion_matrix
print(confusion_matrix(y_true=labels.type(dtype=torch.int32).cpu(),
y_pred=pred.argmax(1).type(dtype=torch.int32).cpu()
))
[[1 2]
[ 3 4]]
The text was updated successfully, but these errors were encountered:
This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.
This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.
Splitting from #3567. Bug has got to do with interoperability of cuml's confusion matrix with torch arrays. However, testing for this is likely to go beyond just confusion matrix.
Adding to this bug:
Code:
The text was updated successfully, but these errors were encountered: