GetValue
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the value of the corresponding offset position of the GlobalTensor.
Prototype
1 | __aicore__ inline __inout_pipe__(S) PrimType GetValue(const uint64_t offset) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
offset |
Input |
Number of elements to offset. |
Returns
Returns an immediate of the PrimType type.
Restrictions
If the content at the global memory address obtained by GetValue may be overwritten externally, call DataCacheCleanAndInvalid first to ensure cache coherence between the data cache and global memory, and then call this API.
Examples
1 2 3 4 5 6 7 8 | // Data (GlobalTensor): [0 100 200 ...] AscendC::GlobalTensor<uint32_t> tiling_global; tiling_global.SetGlobalBuffer(reinterpret_cast<__gm__ uint32_t *>(tiling), 16); const uint16_t C1 = (uint16_t)tiling_global.GetValue(0); const uint16_t H = (uint16_t)tiling_global(1); // The result is as follows: // C1 = 0, H = 100 |
Parent topic: GlobalTensor