aclCreateBoolArray

Function Usage

Creates an aclBoolArray object as the input parameter for single-operator API execution.

aclBoolArray is a framework-defined array structure used to manage and store bool data. You can directly use it without paying attention to its internal implementation.

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.

Returns

Created aclBoolArray on success; else, 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.

Examples

The following code examples are for reference only and are not intended for direct copying and execution:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Create an aclBoolArray.
std::vector<bool> maskData = {true, false};
aclBoolArray *mask = aclCreateBoolArray(maskData.data(), maskData.size());
...
// Use the aclBoolArray as the input parameter for single-operator API execution.
auto ret = aclxxXxxGetWorkspaceSize(srcTensor, mask, ..., outTensor, ..., &workspaceSize, &executor);
ret = aclxxXxx(...);
...
// Destroy the aclBoolArray.
ret = aclDestroyBoolArray(mask);