|
23 | 23 | [ArrayAPI] https://data-apis.org/array-api |
24 | 24 | """ |
25 | 25 |
|
| 26 | +# import for deprecation warning |
| 27 | +import warnings as _warnings |
| 28 | + |
26 | 29 | from dpctl.tensor._copy_utils import asnumpy, astype, copy, from_numpy, to_numpy |
27 | 30 | from dpctl.tensor._ctors import ( |
28 | 31 | arange, |
|
208 | 211 | from ._testing import allclose |
209 | 212 | from ._type_utils import can_cast, finfo, iinfo, isdtype, result_type |
210 | 213 |
|
| 214 | +# deprecation warning for the dpctl.tensor module |
| 215 | +_warnings.warn( |
| 216 | + "dpctl.tensor is deprecated since dpctl 0.21.1 and will be removed in a " |
| 217 | + "future release. The functionality will be moved to separate package, dpnp " |
| 218 | + "(see: https://github.com/IntelPython/dpnp). After that, use " |
| 219 | + "'import dpnp.tensor' instead.", |
| 220 | + DeprecationWarning, |
| 221 | + stacklevel=2, |
| 222 | +) |
| 223 | + |
211 | 224 | __all__ = [ |
212 | 225 | "Device", |
213 | 226 | "usm_ndarray", |
|
397 | 410 | "sycl_device_to_dldevice", |
398 | 411 | "isin", |
399 | 412 | ] |
| 413 | + |
| 414 | + |
| 415 | +def __getattr__(name: str): # pragma: no cover |
| 416 | + # per-attribute access deprecation notices per PEP 562 |
| 417 | + if name in __all__: |
| 418 | + _warnings.warn( |
| 419 | + f"dpctl.tensor.{name} is deprecated; dpctl.tensor is deprecated " |
| 420 | + "since dpctl 0.21.1 and will be removed in a future release. The " |
| 421 | + "functionality will be moved to separate package, dpnp (see: " |
| 422 | + "https://github.com/IntelPython/dpnp). After that, use 'import " |
| 423 | + "dpnp.tensor' instead.", |
| 424 | + DeprecationWarning, |
| 425 | + stacklevel=2, |
| 426 | + ) |
| 427 | + return globals()[name] |
| 428 | + raise AttributeError(f"module 'dpctl.tensor' has no attribute '{name}'") |
0 commit comments