Function: bytes_to_ptr
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Converts a bytes object into void* data. The converted data can be transferred to the C function for direct use.
Prototype
ptr = acl.util.bytes_to_ptr(data)
Parameters
| Parameter | Description |
|---|---|
| data | Data of the bytes type. |
Return Values
| Return Value | Description |
|---|---|
| ptr | Int, data that can be accessed by the C language. |
Constraints
The input lifetime of this function must be greater than the output lifetime. Otherwise, undefined behaviors may occur.
Precautions
Example modification:
bytes_in = np_arr_in.tobytes()
bytes_ptr = acl.util.bytes_to_ptr(bytes_in)