AllocScalarList

Function Usage

Allocates an aclScalarList and specifies the aclScalars contained in it.

Prototype

aclScalarList *AllocScalarList(const aclScalar *const *scalars, uint64_t size)

Parameters

Parameter

Input/Output

Description

scalars

Input

Source data, which is used to initialize aclScalarList.

size

Input

Number of elements in the source data.

Returns

Success: allocated aclScalarList object. Failure: nullptr.

Constraints

The input parameter pointer must not be null.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Initialize five aclScalars and encapsulate them into an aclScalarList.
void Func(aclOpExecutor *executor) {
    int64_t val = 5;
    std::vector<aclScalar *> scalars;
    for (int64_t i = 1; i <= 5; i++) {
        aclScalar *scalar = executor->AllocScalar(val);
        scalars.push_back(scalar);
    }
    aclScalarList *scalarList = executor->AllocScalarList(scalars.data(), scalars.size());
}