aclCreateScalarList

Description

Creates an aclScalarList object as the input parameter for single-operator API calls.

aclScalarList is a built-in list structure for managing and storing multiple scalar data. You can use it without knowing how it works inside.

Prototype

aclScalarList *aclCreateScalarList(const aclScalar *const *value, uint64_t size)

Parameter Description

Parameter

Input/Output

Description

value

Input

Pointer to the start address of the aclScalar pointer array. The aclScalar pointers in the array are copied to the aclScalarList in sequence.

size

Input

Length of the scalar list. The value is a positive integer.

Return Value

Created aclScalarList on success; otherwise, nullptr.

Constraints

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
11
12
13
14
15
16
// Create an alpha1 aclScalar.
float alpha1Value = 1.2f;
aclScalar *alpha1 = aclCreateScalar(&alpha1Value, aclDataType::ACL_FLOAT);
// Create an alpha2 aclScalar.
float alpha2Value = 2.2f;
aclScalar *alpha2 = aclCreateScalar(&alpha2Value, aclDataType::ACL_FLOAT);
// Create an aclScalarList.
std::vector<aclScalar *> tempscalar{alpha1, alpha2};
aclScalarList *scalarlist = aclCreateScalarList(tempscalar.data(), tempscalar.size());
...
// Use the aclScalarList as the input parameter for single-operator API calls.
auto ret = aclxxXxxGetWorkspaceSize(srcTensor, scalarlist, ..., outTensor, ..., &workspaceSize, &executor);
ret = aclxxXxx(...);
...
// Destroy the aclScalarList.
ret = aclDestroyScalarList(scalarlist);