SetData
Function Usage
Sets the data at the specified position for a host tensor obtained through AllocHostTensor.
Prototype
Parameters
- API for setting the value at the specified index
Parameter
Input/Output
Description
index
Input
Sequence number of an aclTensor element to be modified.
value
Input
Value to which a specified element of the aclTensor is changed.
dataType
Input
The data type is . It converts the value to a specified type and then writes the value to the aclTensor.
- API for initializing tensor data with an existing memory
Parameter
Input/Output
Description
value
Input
Data memory pointer to be written to the aclTensor.
size
Input
Number of elements to be written.
dataType
Input
The data type is . The data is converted into a specified data type and then written to aclTensor.
Returns
None
Constraints
The input parameter pointer must not be null.
Examples
1 2 3 4 5 6 | // Initialize an int64_t memory and set the first 10 digits of the input to the content of the memory. Set the 11th digit of the input to the first digit of myArray. void Func(const aclTensor *input) { int64_t myArray[10]; input->SetData(myArray, 10, DT_INT64); input->SetData(10, myArray[0], DT_INT64); } |
Parent topic: common_types