aclCreateScalarList

Function Usage

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

aclScalarList is a framework-defined list structure used to manage and store multiple scalars. You can directly use it without paying attention to its internal implementation.

Prototype

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

Parameters

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.

Returns

Created aclScalarList on success; else, nullptr.

Constraints

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
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 execution.
auto ret = aclxxXxxGetWorkspaceSize(srcTensor, scalarlist, ..., outTensor, ..., &workspaceSize, &executor);
ret = aclxxXxx(...);
...
//Destroy the aclScalarList.
ret = aclDestroyScalarList(scalarlist);