Skip to content

Commit 4acf56c

Browse files
Added more docstrings
1 parent f2c5f18 commit 4acf56c

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

dpctl/tensor/_device.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,37 @@
1818

1919
class Device:
2020
"""
21-
Class representing Data-API concept of Device
21+
Class representing Data-API concept of device.
2222
23-
This is a wrapper around `dpctl.SyclQueue` with custom
23+
This is a wrapper around :class:`dpctl.SyclQueue` with custom
2424
formatting. The class does not have public constructor,
2525
but a class method to construct it from device= keyword
2626
in Array-API functions.
2727
28-
Instance can be queries for `sycl_queue`, `sycl_context`,
29-
or `sycl_device`
28+
Instance can be queried for ``sycl_queue``, ``sycl_context``,
29+
or ``sycl_device``.
3030
"""
3131

3232
def __new__(cls, *args, **kwargs):
3333
raise TypeError("No public constructor")
3434

3535
@classmethod
3636
def create_device(cls, dev):
37+
"""
38+
Device.create_device(device)
39+
40+
Creates instance of Device from argument.
41+
42+
Args:
43+
device: None, :class:`.Device`, :class:`dpctl.SyclQueue`, or
44+
a :class:`dpctl.SyclDevice` corresponding to a root
45+
SYCL device.
46+
Raises:
47+
ValueError: if an instance of :class:`dpctl.SycDevice` corresponding
48+
to a sub-device was specified as the argument
49+
SyclQueueCreationError: if :class:`dpctl.SyclQueue` could not be
50+
created from the argument
51+
"""
3752
obj = super().__new__(cls)
3853
if isinstance(dev, Device):
3954
obj.sycl_queue_ = dev.sycl_queue
@@ -55,14 +70,23 @@ def create_device(cls, dev):
5570

5671
@property
5772
def sycl_queue(self):
73+
"""
74+
:class:`dpctl.SyclQueue` used to offload to this :class:`.Device`.
75+
"""
5876
return self.sycl_queue_
5977

6078
@property
6179
def sycl_context(self):
80+
"""
81+
:class:`dpctl.SyclContext` associated with this :class:`.Device`.
82+
"""
6283
return self.sycl_queue_.sycl_context
6384

6485
@property
6586
def sycl_device(self):
87+
"""
88+
:class:`dpctl.SyclDevice` targed by this :class:`.Device`.
89+
"""
6690
return self.sycl_queue_.sycl_device
6791

6892
def __repr__(self):

0 commit comments

Comments
 (0)