Skip to content

Conversation

@ethanglaser
Copy link
Contributor

@ethanglaser ethanglaser commented Nov 18, 2025

Description

Replacement for #2764 but without modifications to internal dpctl tensor handling. Removes to-be-deprecated dpctl tensor usage in examples and tests, replacing with dpnp array use where appropriate.


Checklist:

Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with updates and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

@ethanglaser ethanglaser changed the title Dev/eglaser dcptl rm pt1 Initial dpctl tensor removal Nov 18, 2025
@ethanglaser
Copy link
Contributor Author

/intelci: run

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
azure 80.34% <ø> (-0.15%) ⬇️
github 81.94% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
onedal/dummy/dummy.py 95.65% <ø> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

print(
"Accuracy for entire rank {} (256 classes): {}\n".format(
rank, accuracy_score(y_test, dpt.to_numpy(y_predict))
rank, accuracy_score(y_test, dpnp.asnumpy(y_predict))
Copy link
Contributor

Choose a reason for hiding this comment

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

accuracy_score supports array API, so it should be possible to pass dpnp arrays to it:
https://scikit-learn.org/stable/modules/array_api.html#metrics

# ==============================================================================

# sklearnex IncrementalPCA example for GPU offloading with DPCtl usm ndarray:
# sklearnex IncrementalPCA example for GPU offloading with DPNP ndarray:
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to have examples that offload to GPU through DPNP arrays if there's already support for array API that can avoid transferring data back and forth with a one-liner change?

"MSE for entire rank {}: {}\n".format(
rank,
mean_squared_error(y_test, dpt.to_numpy(y_predict)),
mean_squared_error(y_test, dpnp.asnumpy(y_predict)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Also supports array API on the sklearn side.

dpnp_X_train = dpnp.asarray(X_train, usm_type="device", sycl_queue=q)
dpnp_y_train = dpnp.asarray(y_train, usm_type="device", sycl_queue=q)
dpnp_X_test = dpnp.asarray(X_test, usm_type="device", sycl_queue=q)
dpnp_y_test = dpnp.asarray(y_test, usm_type="device", sycl_queue=q)
Copy link
Contributor

Choose a reason for hiding this comment

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

In the previous examples, y_test was left as a numpy array, and then y_predict converted to numpy to match with it. Here is is using y_test as dpnp and y_predict as numpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants