Fill
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
√ |
Function Usage
Initializes LocalTensor of a specific TPosition to a specific value.
Prototype
1 2 | template <typename T, typename U = PrimT<T>, typename Std::enable_if<Std::is_same<PrimT<T>, U>::value, bool>::type = true> __aicore__ inline void Fill(const LocalTensor<T>& dst, const InitConstValueParams<U>& initConstValueParams) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of dst. For the For the For the For the For the For the Atlas 350 Accelerator Card, the supported data types are half, int16_t, uint16_t, bfloat16_t, float, int32_t, and uint32_t. |
U |
Data type of the initial value.
The last template parameter is used only for checking the preceding data types. |
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Output |
Destination operand for the result matrix, which is of the LocalTensor type. For the For the For the For the For the For the Atlas 350 Accelerator Card, TPosition can only be A1 or B1. If TPosition is A1/B1, the start address must be 32-byte aligned. If TPosition is A2/B2, the start address must be 512-byte aligned. |
InitConstValueParams |
Input |
Initialization parameters, of the InitConstValueParams type. For details, see ${INSTALL_DIR}/include/ascendc/basic_api/interface/kernel_struct_mm.h. Replace ${INSTALL_DIR} with the actual path for storing files after the CANN software is installed. For details about the parameter description, see Table 3. For the For the For the For the For the For the Atlas 350 Accelerator Card, all parameters can be configured.
|
Parameter |
Description |
|---|---|
repeatTimes |
Number of iterations. Default value: 0.
|
blockNum |
Number of data blocks initialized in each iteration. Value range: blockNum ∈ [0, 32767]. Default value: 0.
|
dstGap |
Gap between the end address of the previous iteration and the start address of the next iteration of the destination operand.
Value range: dstGap ∈ [0, 32767]. Default value: 0. |
initValue |
Initialized value. The supported data types are the same as those of dst. |
Restrictions
- For details about the operand address alignment requirements, see General Address Alignment Restrictions.
Examples
1 2 3 | uint32 mLength = 16; uint32 kLength = 16; Fill(leftMatrix, {1, static_cast<uint16_t>(mLength * kLength * sizeof(float) / 32), 0, 1}); // It fills leftMatrix with mLength × kLength elements, each set to the value 1, using 32-byte granularity. |