Add ```__array__``` attribute support to ```usm_ndarray```
The decision to implement a TypeError broke a significant amount of the sklearnex interfaces for dpctl tensors and has prevented us from properly upgrading to 0.20 support for nearly a half of a year. Instead of raising a TypeError suggesting to use asnumpy simply use asnumpy for the __array__ method.
I expect that the solution in #1964 was a stopgap. Was that the case?
@icfaust #1964 was not a stopgap, it was an intended behavior—there are a number of performance concerns with implicit conversion to NumPy array. One of the biggest is something like:
r = x_np * y_dpt + z_dpt
which would implicit leave r as a NumPy array, without any clarification to the user, and introduces several synchronizations. We would prefer to avoid such behavior. Neither cupy nor dpnp allow this behavior either.
cupy has discussed implementing an environment variable that would allow this behavior, and that would be acceptable here as well, but default behavior should remain the same.
An additional note, we are planning to introduce deprecation of dpctl.tensor to delegate all array functionality to dpnp, with the intention of moving tensor to dpnp most likely early next year.