aclCreateFloatArray
Function Usage
Creates an aclFloatArray object as the input parameter for single-operator API execution.
aclFloatArray is a framework-defined array structure used to manage and store floating-point data. You can directly use it without paying attention to its internal implementation.
Prototype
aclFloatArray *aclCreateFloatArray(const float *value, uint64_t size)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
value |
Input |
Float pointer on the host. Its value will be copied to the aclFloatArray. |
size |
Input |
Length of a floating-point array. The value is a positive integer. |
Returns
Created aclFloatArray on success; else, nullptr.
Constraints
- This API must be used together with aclDestroyFloatArray. They are used to create and destroy the aclFloatArray, respectively.
- The size of the aclFloatArray can be obtained by calling aclGetFloatArraySize.
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 aclFloatArray. std::vector<float> scalesData = {1.0, 1.0, 2.0, 2.0}; aclFloatArray *scales = aclCreateFloatArray(scalesData.data(),scalesData.size()); ... // Use the aclFloatArray as the input parameter for single-operator API execution. auto ret = aclxxXxxGetWorkspaceSize(srcTensor, scales, ..., outTensor, ..., &workspaceSize, &executor); ret = aclxxXxx(...); ... //Destroy the aclFloatArray. ret = aclDestroyFloatArray(scales); |
Parent topic: Common APIs