-
Notifications
You must be signed in to change notification settings - Fork 184
Initial dpctl tensor removal #2779
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
base: main
Are you sure you want to change the base?
Initial dpctl tensor removal #2779
Conversation
|
/intelci: run |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| 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)) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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)), |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
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
Testing