Function: ptr_to_numpy
C Prototype |
None |
---|---|
Python Function |
output = acl.util.ptr_to_numpy(prt, shape, type) |
Function Usage |
Converts void* data to NumPy data so that Python code can directly access the data. |
Input Description |
ptr: int, pointer in C. It is the start address of the data that can be accessed. shape: tuple, shape of the NumPy to be constructed. type: int, data type of the data in ptr. The following lists some common types: (For details about the types that are not listed, data type APIs in NumPy C-API, and APIs of the following types, see the manual.) 0: NPY_BOOL 1: NPY_BYTE, NPY_INT8 2: NPY_UINT8 3: NPY_SHORT, NPY_INT16 4: NPY_USHORT, NPY_UINT16 5: NPY_INT, NPY_INT32 6: NPY_UINT, NPY_UINT32 7: NPY_INT64 8: NPY_UINT64 9: NPY_LONGLONG 10: NPY_ULONGLONG 11: NPY_FLOAT32 12: NPY_DOUBLE 23: NPY_HALF, NPY_FLOAT16 |
Return Value |
output: NumPy type. |
Restrictions |
None |
Precautions |
None (Zero copy has been achieved.) |