Functions to acceleratе FusedLayer in Synet Framework. More...
Functions | |
| SIMD_API void | SimdSynetFusedLayerForward0 (const float *src, const float *bias, const float *scale, size_t channels, size_t spatial, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 0). More... | |
| SIMD_API void | SimdSynetFusedLayerForward1 (const float *src, const float *bias0, const float *scale1, const float *bias1, size_t channels, size_t spatial, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 1). More... | |
| SIMD_API void | SimdSynetFusedLayerForward2 (const float *src, const float *scale, const float *bias, size_t channels, size_t spatial, const float *slope, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 2). More... | |
| SIMD_API void | SimdSynetFusedLayerForward3 (const float *src, const float *scale, const float *bias, size_t channels, size_t spatial, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 3). More... | |
| SIMD_API void | SimdSynetFusedLayerForward4 (const float *src, const float *bias0, const float *scale1, const float *bias1, size_t channels, size_t spatial, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 4). More... | |
| SIMD_API void | SimdSynetFusedLayerForward8 (const float *src0, const float *src1, const float *src2, size_t channels, size_t spatial, float *dst, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 8). More... | |
| SIMD_API void | SimdSynetFusedLayerForward9 (const float *src0, const float *src1, const float *scale, const float *bias, size_t channels0, size_t channels1, size_t spatial, float *dst0, float *dst1, SimdTensorFormatType format) |
| This function is used for forward propagation of FusedLayer (type 9). More... | |
Detailed Description
Functions to acceleratе FusedLayer in Synet Framework.
Function Documentation
◆ SimdSynetFusedLayerForward0()
| void SimdSynetFusedLayerForward0 | ( | const float * | src, |
| const float * | bias, | ||
| const float * | scale, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 0).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
o = c*spatial + s;
x = src[o] + bias[c];
dst[o] = (x - abs(x))*scale[c] + max(0, x);
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src - a pointer to the 32-bit float array with input image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] bias - a pointer to the 32-bit float array with bias coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] scale - a pointer to the 32-bit float array with scale coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] channels - a number of channels in the (input/output) image tensor. [in] spatial - a spatial size of (input/output) image tensor. [out] dst - a pointer to the 32-bit float array with output image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward1()
| void SimdSynetFusedLayerForward1 | ( | const float * | src, |
| const float * | bias0, | ||
| const float * | scale1, | ||
| const float * | bias1, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 1).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
o = c*spatial + s;
x = src[o] + bias0[c];
dst[o] = max(0, -x)*scale1[c] + bias1[c] + max(0, x);
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src - a pointer to the 32-bit float array with input image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] bias0 - a pointer to the 32-bit float array with bias0 coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] scale1 - a pointer to the 32-bit float array with scale1 coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] bias1 - a pointer to the 32-bit float array with bias1 coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] channels - a number of channels in the (input/output) image tensor. [in] spatial - a spatial size of (input/output) image tensor. [out] dst - a pointer to the 32-bit float array with output image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward2()
| void SimdSynetFusedLayerForward2 | ( | const float * | src, |
| const float * | scale, | ||
| const float * | bias, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| const float * | slope, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 2).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
o = c*spatial + s;
x = src[o]*scale[c] + bias[c];
dst[o] = max(0, x) + min(0, x)*slope[0];
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src - a pointer to the 32-bit float array with input image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] scale - a pointer to the 32-bit float array with scale coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] bias - a pointer to the 32-bit float array with bias coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] channels - a number of channels in the (input/output) image tensor. [in] spatial - a spatial size of (input/output) image tensor. [in] slope - a pointer to the 32-bit float slope coefficient. [out] dst - a pointer to the 32-bit float array with output image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward3()
| void SimdSynetFusedLayerForward3 | ( | const float * | src, |
| const float * | scale, | ||
| const float * | bias, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 3).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
o = c*spatial + s;
x = src[o] + bias[c];
dst[o] = max(0, x) + min(0, x)*scale[c];
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src - a pointer to the 32-bit float array with input image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] bias - a pointer to the 32-bit float array with bias coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] scale - a pointer to the 32-bit float array with scale coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] channels - a number of channels in the (input/output) image tensor. [in] spatial - a spatial size of (input/output) image tensor. [out] dst - a pointer to the 32-bit float array with output image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward4()
| void SimdSynetFusedLayerForward4 | ( | const float * | src, |
| const float * | bias0, | ||
| const float * | scale1, | ||
| const float * | bias1, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 4).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
x = src[c*spatial + s] + bias0[c];
dst[c*spatial + s] = std::max((T)0, x);
dst[(c + channels)*spatial + s] = std::max((T)0, x*scale1[0] + bias1[0]);
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src - a pointer to the 32-bit float array with input image tensor. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] bias0 - a pointer to the 32-bit float array with bias0 coefficients. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] scale1 - a pointer to the 32-bit float array with scale1 coefficients. The size of the array is 1. [in] bias1 - a pointer to the 32-bit float array with bias1 coefficients. The size of the array is 1. [in] channels - a number of channels in the input image tensor. Output image tensor has 2 * channels. [in] spatial - a spatial size of (input/output) image tensor. [out] dst - a pointer to the 32-bit float array with output image tensor. The size of the array is SimdAlign (2 * channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward8()
| void SimdSynetFusedLayerForward8 | ( | const float * | src0, |
| const float * | src1, | ||
| const float * | src2, | ||
| size_t | channels, | ||
| size_t | spatial, | ||
| float * | dst, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 8).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels; ++c)
for(s = 0; s < spatial; ++s)
{
o = c*spatial + s;
dst[o] = src0[o] + src1[o]*src2[c];
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src0 - a pointer to the first input 32-bit float array. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] src1 - a pointer to the second input 32-bit float array. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] src2 - a pointer to the third input 32-bit float array. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)). [in] channels - a number of channels in the (input/output) image tensor. [in] spatial - a spatial size of (input/output) image tensor. [out] dst - a pointer to the output 32-bit float array. The size of the array is SimdAlign (channels, SimdSynetTensorAlignment (format)) * spatial. [in] format - a format of (input/output) image tensor.
◆ SimdSynetFusedLayerForward9()
| void SimdSynetFusedLayerForward9 | ( | const float * | src0, |
| const float * | src1, | ||
| const float * | scale, | ||
| const float * | bias, | ||
| size_t | channels0, | ||
| size_t | channels1, | ||
| size_t | spatial, | ||
| float * | dst0, | ||
| float * | dst1, | ||
| SimdTensorFormatType | format | ||
| ) |
This function is used for forward propagation of FusedLayer (type 9).
Algorithm's details (example for NCHW tensor format):
for(c = 0; c < channels0; ++c)
for(s = 0; s < spatial; ++s)
{
dst0[c*spatial + s] = max(0, src0[c*spatial + s]*scale[c] + bias[c]);
if(dst1)
dst1[c*spatial + s] = src0[c*spatial + s];
}
for(c = 0; c < channels1; ++c)
for(s = 0; s < spatial; ++s)
{
dst0[(c + channels0)*spatial + s] = max(0, src1[c*spatial + s]*scale[channels0 + c] + bias[channels0 + c]);
if(dst1)
dst1[(c + channels0)*spatial + s] = src1[c*spatial + s];
}
- Note
- This function is used in Synet Framework.
- Parameters
-
[in] src0 - a pointer to the first input 32-bit float array. The size of the array is SimdAlign (channels0, SimdSynetTensorAlignment (format)) * spatial. [in] src1 - a pointer to the second input 32-bit float array. The size of the array is SimdAlign (channels1, SimdSynetTensorAlignment (format)) * spatial. [in] scale - a pointer to the 32-bit float array with scale coefficients. The size of the array is SimdAlign (channels0 + channels1, SimdSynetTensorAlignment (format)). [in] bias - a pointer to the 32-bit float array with bias coefficients. The size of the array is SimdAlign (channels0 + channels1, SimdSynetTensorAlignment (format)). [in] channels0 - a number of channels in the first input image tensor. [in] channels1 - a number of channels in the second input image tensor. [in] spatial - a spatial size of (input/output) image tensor. [out] dst0 - a pointer to the first output 32-bit float array. The size of the array is SimdAlign (channels0 + channels1, SimdSynetTensorAlignment (format)) * spatial. [out] dst1 - a pointer to the second output 32-bit float array. The size of the array is SimdAlign (channels0 + channels1, SimdSynetTensorAlignment (format)) * spatial. The pointer can be NULL. [in] format - a format of (input/output) image tensor.
