diff --git a/cuda_core/cuda/core/experimental/_memoryview.pyx b/cuda_core/cuda/core/experimental/_memoryview.pyx index 61ff09dff4..feca227821 100644 --- a/cuda_core/cuda/core/experimental/_memoryview.pyx +++ b/cuda_core/cuda/core/experimental/_memoryview.pyx @@ -48,20 +48,20 @@ cdef class StridedMemoryView: ---------- ptr : int Pointer to the tensor buffer (as a Python `int`). - shape: tuple + shape : tuple Shape of the tensor. - strides: tuple + strides : tuple Strides of the tensor (in **counts**, not bytes). dtype: numpy.dtype Data type of the tensor. - device_id: int + device_id : int The device ID for where the tensor is located. It is -1 for CPU tensors (meaning those only accessible from the host). - is_device_accessible: bool + is_device_accessible : bool Whether the tensor data can be accessed on the GPU. readonly: bool Whether the tensor data can be modified in place. - exporting_obj: Any + exporting_obj : Any A reference to the original tensor object that is being viewed. Parameters @@ -334,7 +334,8 @@ cdef StridedMemoryView view_as_cai(obj, stream_ptr, view=None): def args_viewable_as_strided_memory(tuple arg_indices): - """Decorator to create proxy objects to :obj:`StridedMemoryView` for the + """ + Decorator to create proxy objects to :obj:`StridedMemoryView` for the specified positional arguments. This allows array/tensor attributes to be accessed inside the function diff --git a/cuda_core/docs/source/conf.py b/cuda_core/docs/source/conf.py index 1b89006fa9..7c42cd7d04 100644 --- a/cuda_core/docs/source/conf.py +++ b/cuda_core/docs/source/conf.py @@ -10,8 +10,11 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. import os +import sys +from unittest.mock import MagicMock + +from cuda.core.experimental._system import System -# import sys # sys.path.insert(0, os.path.abspath('.')) @@ -102,6 +105,24 @@ napoleon_numpy_docstring = True +# Mock the System class and its methods +class MockSystem: + def __init__(self, *args, **kwargs): + pass + + driver_version = MagicMock() + driver_version.__doc__ = System.driver_version.__doc__ + num_devices = MagicMock() + num_devices.__doc__ = System.num_devices.__doc__ + devices = MagicMock() + devices.__doc__ = System.devices.__doc__ + + +sys.modules["cuda.core.experimental._system.System"] = MagicMock(System=MockSystem) + +# Add 'cuda.core.experimental.system' to autodoc_mock_imports +autodoc_mock_imports = ["cuda.core.experimental.system"] + section_titles = ["Returns"]