aclCreateBoolArray
Description
Creates an aclBoolArray object as the input parameter for single-operator API calls.
aclBoolArray is a built-in array for managing and storing Boolean data. You can use it without knowing how it works inside.
Prototype
aclBoolArray *aclCreateBoolArray(const bool *value, uint64_t size)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
value |
Input |
Bool pointer on the host. Its value will be copied to the aclBoolArray. |
size |
Input |
Length of a bool array. The value is a positive integer. |
Return Value
Created aclBoolArray on success; otherwise, nullptr.
Constraints
- This API must be used together with aclDestroyBoolArray. They are used to create and destroy the aclBoolArray, respectively.
- The size of the aclBoolArray can be obtained by calling aclGetBoolArraySize.
Example
The following sample code is for reference only. Do not copy and run it.
1 2 3 4 5 6 7 8 9 10 | // Create an aclBoolArray. bool maskData[] = {true, false}; aclBoolArray *mask = aclCreateBoolArray(maskData, sizeof(maskData) / sizeof(maskData[0])); ... // Use the aclBoolArray as the input parameter for single-operator API calls. auto ret = aclxxXxxGetWorkspaceSize(srcTensor, mask, ..., outTensor, ..., &workspaceSize, &executor); ret = aclxxXxx(...); ... // Destroy the aclBoolArray. ret = aclDestroyBoolArray(mask); |
Parent topic: Common APIs