GatherElements algorithm
Functions to acceleratе GatherElements algorithm in Synet Framework. More...
Functions | |
| SIMD_API void * | SimdSynetGatherElementsInit (SimdTensorDataType dataType, SimdTensorDataType indexType, SimdBool indexConst, size_t indexUsers, const size_t *outer, size_t outerSize, size_t srcCount, size_t inner, size_t idxCount) |
| SIMD_API void | SimdSynetGatherElementsSetIndex (const void *context, const uint8_t *idx) |
| Sets and analyses constant gather elements indexes. More... | |
| SIMD_API size_t | SimdSynetGatherElementsInternalBufferSize (const void *context) |
| Gets size of internal buffer in bytes used inside gather elements algorithm. More... | |
| SIMD_API void | SimdSynetGatherElementsForward (void *context, const uint8_t *src, const uint8_t *idx, uint8_t *dst) |
| Performs forward propagation of gather elements algorithm. More... | |
Detailed Description
Functions to acceleratе GatherElements algorithm in Synet Framework.
Function Documentation
◆ SimdSynetGatherElementsInit()
| void * SimdSynetGatherElementsInit | ( | SimdTensorDataType | dataType, |
| SimdTensorDataType | indexType, | ||
| SimdBool | indexConst, | ||
| size_t | indexUsers, | ||
| const size_t * | outer, | ||
| size_t | outerSize, | ||
| size_t | srcCount, | ||
| size_t | inner, | ||
| size_t | idxCount | ||
| ) |
Algorithm's details:
for (o = 0; o < outer; ++o)
for (c = 0; c < idxCount; ++c)
for (i = 0; i < inner; ++i)
ic = idx[o, c, i];
if (ic < 0)
ic += srcCount;
dst[o, c, i] = src[o, ic, i];
- Parameters
-
[in] dataType - a type of input and output tensor. [in] indexType - a type of index tensor. It can be INT32 or INT64. [in] indexConst - a flag of constant index. If this flag is True then you can set index once. [in] indexUsers - a number of index users. [in] outer - a pointer to outer shape of input and output tensor. [in] outerSize - a size of outer shape of input and output tensor. [in] srcCount - an input tensor gather dimension. [in] inner - an inner size of input and output tensor. [in] idxCount - an index and output tensor gather dimension.
- Returns
- a pointer to gather elements context. On error it returns NULL. It must be released with using of function SimdRelease. This pointer is used in functions :: SimdSynetGatherElementsSetIndex, SimdSynetGatherElementsInternalBufferSize, and SimdSynetGatherElementsForward.
◆ SimdSynetGatherElementsSetIndex()
| void SimdSynetGatherElementsSetIndex | ( | const void * | context, |
| const uint8_t * | idx | ||
| ) |
Sets and analyses constant gather elements indexes.
- Parameters
-
[in] context - a pointer to gather elements context. It must be created by function SimdSynetGatherElementsInit and released by function SimdRelease. [in] idx - a pointer to tensor with indexes. It can be INT32 or INT64. Its size = outer[0] * .. * outer[outerSize - 1] * idxCount * inner.
◆ SimdSynetGatherElementsInternalBufferSize()
| size_t SimdSynetGatherElementsInternalBufferSize | ( | const void * | context | ) |
Gets size of internal buffer in bytes used inside gather elements algorithm.
- Parameters
-
[in] context - a pointer to gather elements context. It must be created by function SimdSynetGatherElementsInit and released by function SimdRelease.
- Returns
- size of internal buffer in bytes used inside gather elements algorithm.
◆ SimdSynetGatherElementsForward()
| void SimdSynetGatherElementsForward | ( | void * | context, |
| const uint8_t * | src, | ||
| const uint8_t * | idx, | ||
| uint8_t * | dst | ||
| ) |
Performs forward propagation of gather elements algorithm.
- Parameters
-
[in] context - a pointer to gather elements algorithm. It must be created by function SimdSynetGatherElementsInit and released by function SimdRelease. [in] src - a pointer to input tensor. Its size = outer[0] * .. * outer[outerSize - 1] * srcCount * inner. [in] idx - a pointer to index tensor. Its size = outer[0] * .. * outer[outerSize - 1] * idxCount * inner. [out] dst - a pointer to output tensor. Its size = outer[0] * .. * outer[outerSize - 1] * idxCount * inner.