qbruntime.accelerator.Accelerator Class Reference#
|
SDK qb Runtime Library v1.3
MCS001-EN
|
qbruntime.accelerator.Accelerator Class Reference
Represents an accelerator, i.e., an NPU, used for executing models. More...
Public Member Functions | |
| __init__ (self, int dev_no=0) | |
| Creates an Accelerator object for a specific device number. | |
| PinnedMemory | allocate_pinned_memory (self, Sequence[int] shape, np.dtype dtype) |
| Allocates an NPU-accessible pinned memory buffer. | |
Protected Attributes | |
| _accelerator = _cQbRuntime.Accelerator(dev_no) | |
Detailed Description
Represents an accelerator, i.e., an NPU, used for executing models.
Definition at line 17 of file accelerator.py.
Constructor & Destructor Documentation
◆ __init__()
| qbruntime.accelerator.Accelerator.__init__ | ( | self, | |
| int | dev_no = 0 ) |
Creates an Accelerator object for a specific device number.
The dev_no parameter represents the device number. For example, on Linux, if an ARIES NPU is attached as /dev/aries0, the device number is 0.
- Parameters
-
dev_no The device number to associate with the Accelerator.
Definition at line 20 of file accelerator.py.
Member Function Documentation
◆ allocate_pinned_memory()
| PinnedMemory qbruntime.accelerator.Accelerator.allocate_pinned_memory | ( | self, | |
| Sequence[int] | shape, | ||
| np.dtype | dtype ) |
Allocates an NPU-accessible pinned memory buffer.
The returned buffer can be used as input or output for zero-copy inference via Model.infer_pinned_memory.
- Note
- This is an experimental API and is only supported on Regulus hardware.
- Parameters
-
shape The shape of the buffer to allocate. dtype The element type of the buffer. Must be numpy.float32 or numpy.uint8.
- Returns
- A PinnedMemory wrapping the allocated buffer.
Definition at line 31 of file accelerator.py.
Member Data Documentation
◆ _accelerator
|
protected |
Definition at line 29 of file accelerator.py.
The documentation for this class was generated from the following file:
Generated by