Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub | SourceForge
Synet Framework

Functions for accelerating of Synet Framework. More...

Enumerations

enum  SimdSynetEltwiseOperationType {
  SimdSynetEltwiseOperationProduct,
  SimdSynetEltwiseOperationSum,
  SimdSynetEltwiseOperationMax
}
 

Functions

SIMD_API void SimdSynetAddBias (const float *bias, size_t count, size_t size, float *dst)
 Adds a bias to given vector. More...
 
SIMD_API void SimdSynetEltwiseLayerForward (float const *const *src, const float *weight, size_t count, size_t size, SimdSynetEltwiseOperationType type, float *dst)
 This function is used for forward propagation of EltwiseLayer. More...
 
SIMD_API void SimdSynetLrnLayerCrossChannels (const float *src, size_t half, size_t count, size_t size, const float *k, float *dst)
 This function is used for forward propagation of LrnLayer (cross channels normalization). More...
 
SIMD_API void SimdSynetScaleLayerForward (const float *src, const float *scale, const float *bias, size_t count, size_t size, float *dst)
 This function is used for forward propagation of ScaleLayer. More...
 

Detailed Description

Functions for accelerating of Synet Framework.

Enumeration Type Documentation

◆ SimdSynetEltwiseOperationType

Describes operation type used in function SimdSynetEltwiseLayerForward.

Enumerator
SimdSynetEltwiseOperationProduct 

Product.

SimdSynetEltwiseOperationSum 

Weighted sum.

SimdSynetEltwiseOperationMax 

Maximum.

Function Documentation

◆ SimdSynetAddBias()

void SimdSynetAddBias ( const float *  bias,
size_t  count,
size_t  size,
float *  dst 
)

Adds a bias to given vector.

Algorithm's details:

 for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
        dst[i*size + j] += bias[i];
Note
This function is used in Synet Framework.
Parameters
[in]bias- a pointer to the 32-bit float array with bias coefficients.
[in]count- a size of bias array.
[in]size- an internal size of bias addition.
[in,out]dst- a pointer to cumulative 32-bit float array. The size of the array must be equal to count*size.

◆ SimdSynetEltwiseLayerForward()

void SimdSynetEltwiseLayerForward ( float const *const *  src,
const float *  weight,
size_t  count,
size_t  size,
SimdSynetEltwiseOperationType  type,
float *  dst 
)

This function is used for forward propagation of EltwiseLayer.

Algorithm's details for SimdSynetEltwiseOperationProduct:

for(j = 0; j < size; ++j)
    dst[j] = 1;
for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
        dst[j] *= src[i][j];

Algorithm's details for SimdSynetEltwiseOperationSum:

for(j = 0; j < size; ++j)
    dst[j] = 0;
for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
        dst[j] += src[i][j]*weight[i];

Algorithm's details for SimdSynetEltwiseOperationMax:

for(j = 0; j < size; ++j)
    dst[j] = -FLT_MAX;
for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
        dst[j] = max(dst[j], src[i][j]);
Note
This function is used in Synet Framework.
Parameters
[in]src- a pointer to poitres to the input 32-bit float arrays.
[in]weight- a pointer to the 32-bit float array with sum coefficients. It is need only for SimdSynetEltwiseOperationSum operation type otherwise it can be NULL.
[in]count- a count of input arrays. Must be at least 2.
[in]size- a size of the input and output arrays.
[in]type- a type of operation (see SimdSynetEltwiseOperationType).
[out]dst- a pointer to the output 32-bit float array.

◆ SimdSynetLrnLayerCrossChannels()

void SimdSynetLrnLayerCrossChannels ( const float *  src,
size_t  half,
size_t  count,
size_t  size,
const float *  k,
float *  dst 
)

This function is used for forward propagation of LrnLayer (cross channels normalization).

Algorithm's details:

for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
    {
        lo = Max(0, i - half);
        ln = Min(count, i + half + 1);
        sum = 0;
        for(l = lo; l < ln; ++l)
            sum += Square(src[l*size + j]);
        dst[i*size + j] = src[i*size + j]*Pow(k[0] + sum*k[1], k[2]);
    }
Note
This function is used in Synet Framework.
Parameters
[in]src- a pointer to the input 32-bit float array. The size of the array must be equal to count*size.
[in]half- a local normalization half size.
[in]count- a channels count.
[in]size- an internal size of the operation.
[in]k- a pointer to the 32-bit float array with 3 coefficients (see algorithm details).
[out]dst- a pointer to the output 32-bit float array. The size of the array must be equal to count*size.

◆ SimdSynetScaleLayerForward()

void SimdSynetScaleLayerForward ( const float *  src,
const float *  scale,
const float *  bias,
size_t  count,
size_t  size,
float *  dst 
)

This function is used for forward propagation of ScaleLayer.

Algorithm's details:

for(i = 0; i < count; ++i)
    for(j = 0; j < size; ++j)
        dst[i*size + j] = src[i*size + j]*scale[i] + (bias ? bias[i] : 0);
Note
This function is used in Synet Framework.
Parameters
[in]src- a pointer to the input 32-bit float array. The size of the array must be equal to count*size.
[in]scale- a pointer to the 32-bit float array with scale coefficients.
[in]bias- a pointer to the 32-bit float array with bias coefficients. Can be NULL.
[in]count- a size of scale and bias arrays.
[in]size- an internal size of the operation.
[out]dst- a pointer to the output 32-bit float array. The size of the array must be equal to count*size.