Skip to content

__array_namespace_info__.dtypes raises AttributeError for device passed as a string #1978

Closed
@antonwolfy

Description

@antonwolfy

Based on dpctl documentation Info.dtypes support a string value of device keyword argument:

device (Optional[:class:dpctl.SyclDevice, :class:dpctl.SyclQueue, :class:dpctl.tensor.Device, str])

but the example below does not work and raises AttributeError exception:

import dpctl, dpctl.tensor as dpt

dpctl.__version__
# Out: '0.19.0dev0+480.g360ce45dc6'

info = dpnp.__array_namespace_info__()
info.dtypes(device="gpu")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 info.dtypes(device="gpu")

File ~/miniforge3/envs/dpnp_dev/lib/python3.11/site-packages/dpctl/tensor/_array_api.py:203, in Info.dtypes(self, device, kind)
    201 elif isinstance(device, dpt.Device):
    202     device = device.sycl_device
--> 203 _fp64 = device.has_aspect_fp64
    204 if kind is None:
    205     return {
    206         key: val
    207         for key, val in self._all_dtypes.items()
    208         if (key != "float64" or _fp64)
    209     }

AttributeError: 'str' object has no attribute 'has_aspect_fp64'

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions