ARM Compute Library
17.04
|
#include "helpers.h"
Go to the source code of this file.
Macros | |
#define | MINVAL FLT_MIN |
#define | SELECT_DATA_TYPE int |
#define | DATA_TYPE float |
Functions | |
__kernel void | softmax_layer_max (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes, uint width) |
Identifies the maximum value across the 1st dimension. More... | |
__kernel void | softmax_layer_shift_exp_sum (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *max_ptr, uint max_stride_x, uint max_step_x, uint max_stride_y, uint max_step_y, uint max_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes, __global uchar *sum_ptr, uint sum_stride_x, uint sum_step_x, uint sum_stride_y, uint sum_step_y, uint sum_offset_first_element_in_bytes, uint width) |
Shifts the values of the input tensor by the max calculated in softmax_layer_max kernel, then gets the exponent of each element as sums all elements across each row. More... | |
__kernel void | softmax_layer_norm (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *sum_ptr, uint sum_stride_x, uint sum_step_x, uint sum_stride_y, uint sum_step_y, uint sum_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes) |
Divides all the values of the input tensor by the sum calculated from softmax_layer_shift_exp_sum kernel. More... | |
Variables | |
__constant float16 | type_min = ( float16 )( FLT_MIN ) |
__constant uint16 | idx16 = (uint16)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) |
#define DATA_TYPE float |
Definition at line 33 of file softmax_layer.cl.
Referenced by softmax_layer_norm(), and softmax_layer_shift_exp_sum().
#define MINVAL FLT_MIN |
Definition at line 31 of file softmax_layer.cl.
#define SELECT_DATA_TYPE int |
Definition at line 32 of file softmax_layer.cl.
Referenced by softmax_layer_max(), and softmax_layer_shift_exp_sum().
__kernel void softmax_layer_max | ( | __global uchar * | src_ptr, |
uint | src_stride_x, | ||
uint | src_step_x, | ||
uint | src_stride_y, | ||
uint | src_step_y, | ||
uint | src_offset_first_element_in_bytes, | ||
__global uchar * | dst_ptr, | ||
uint | dst_stride_x, | ||
uint | dst_step_x, | ||
uint | dst_stride_y, | ||
uint | dst_step_y, | ||
uint | dst_offset_first_element_in_bytes, | ||
uint | width | ||
) |
Identifies the maximum value across the 1st dimension.
[in] | src_ptr | Pointer to the source tensor slice. Supported data types: F16, F32 |
[in] | src_stride_x | Stride of the source tensor in X dimension (in bytes) |
[in] | src_step_x | src_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src_stride_y | Stride of the source tensor in Y dimension (in bytes) |
[in] | src_step_y | src_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src_offset_first_element_in_bytes | The offset of the first element in the source tensor |
[out] | dst_ptr | Pointer to the destination tensor slice. Supported data types: F16, F32 |
[in] | dst_stride_x | Stride of the destination tensor in X dimension (in bytes) |
[in] | dst_step_x | dst_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | dst_stride_y | Stride of the destination tensor in Y dimension (in bytes) |
[in] | dst_step_y | dst_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | dst_offset_first_element_in_bytes | The offset of the first element in the destination tensor |
[in] | width | Input image width |
Definition at line 59 of file softmax_layer.cl.
References CONVERT, CONVERT_TO_IMAGE_STRUCT, idx16, offset(), Image::ptr, SELECT_DATA_TYPE, type_min, and VEC_DATA_TYPE.
__kernel void softmax_layer_norm | ( | __global uchar * | src_ptr, |
uint | src_stride_x, | ||
uint | src_step_x, | ||
uint | src_stride_y, | ||
uint | src_step_y, | ||
uint | src_offset_first_element_in_bytes, | ||
__global uchar * | sum_ptr, | ||
uint | sum_stride_x, | ||
uint | sum_step_x, | ||
uint | sum_stride_y, | ||
uint | sum_step_y, | ||
uint | sum_offset_first_element_in_bytes, | ||
__global uchar * | dst_ptr, | ||
uint | dst_stride_x, | ||
uint | dst_step_x, | ||
uint | dst_stride_y, | ||
uint | dst_step_y, | ||
uint | dst_offset_first_element_in_bytes | ||
) |
Divides all the values of the input tensor by the sum calculated from softmax_layer_shift_exp_sum kernel.
[in] | src_ptr | Pointer to the source tensor slice. Supported data types: F16, F32 |
[in] | src_stride_x | Stride of the source tensor in X dimension (in bytes) |
[in] | src_step_x | src_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src_stride_y | Stride of the source tensor in Y dimension (in bytes) |
[in] | src_step_y | src_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src_offset_first_element_in_bytes | The offset of the first element in the source tensor |
[in] | sum_ptr | Pointer to the sum values tensor slice. Supported data types: F16, F32 |
[in] | sum_stride_x | Stride of the sum values tensor in X dimension (in bytes) |
[in] | sum_step_x | sum_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | sum_stride_y | Stride of the sum values tensor in Y dimension (in bytes) |
[in] | sum_step_y | sum_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | sum_offset_first_element_in_bytes | The offset of the first element in the sum values tensor |
[out] | dst_ptr | Pointer to the destination tensor slice. Supported data types: F16, F32 |
[in] | dst_stride_x | Stride of the destination tensor in X dimension (in bytes) |
[in] | dst_step_x | dst_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | dst_stride_y | Stride of the destination tensor in Y dimension (in bytes) |
[in] | dst_step_y | dst_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | dst_offset_first_element_in_bytes | The offset of the first element in the destination tensor |
Definition at line 207 of file softmax_layer.cl.
References CONVERT_TO_IMAGE_STRUCT, CONVERT_TO_IMAGE_STRUCT_NO_STEP, DATA_TYPE, offset(), and VEC_DATA_TYPE.
__kernel void softmax_layer_shift_exp_sum | ( | __global uchar * | src_ptr, |
uint | src_stride_x, | ||
uint | src_step_x, | ||
uint | src_stride_y, | ||
uint | src_step_y, | ||
uint | src_offset_first_element_in_bytes, | ||
__global uchar * | max_ptr, | ||
uint | max_stride_x, | ||
uint | max_step_x, | ||
uint | max_stride_y, | ||
uint | max_step_y, | ||
uint | max_offset_first_element_in_bytes, | ||
__global uchar * | dst_ptr, | ||
uint | dst_stride_x, | ||
uint | dst_step_x, | ||
uint | dst_stride_y, | ||
uint | dst_step_y, | ||
uint | dst_offset_first_element_in_bytes, | ||
__global uchar * | sum_ptr, | ||
uint | sum_stride_x, | ||
uint | sum_step_x, | ||
uint | sum_stride_y, | ||
uint | sum_step_y, | ||
uint | sum_offset_first_element_in_bytes, | ||
uint | width | ||
) |
Shifts the values of the input tensor by the max calculated in softmax_layer_max kernel, then gets the exponent of each element as sums all elements across each row.
[in] | src_ptr | Pointer to the source tensor slice. Supported data types: F16, F32 |
[in] | src_stride_x | Stride of the source tensor in X dimension (in bytes) |
[in] | src_step_x | src_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | src_stride_y | Stride of the source tensor in Y dimension (in bytes) |
[in] | src_step_y | src_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | src_offset_first_element_in_bytes | The offset of the first element in the source tensor |
[in] | max_ptr | Pointer to the max values tensor slice. Supported data types: F16, F32 |
[in] | max_stride_x | Stride of the max values tensor in X dimension (in bytes) |
[in] | max_step_x | max_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | max_stride_y | Stride of the max values tensor in Y dimension (in bytes) |
[in] | max_step_y | max_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | max_offset_first_element_in_bytes | The offset of the first element in the max values tensor |
[out] | dst_ptr | Pointer to the destination tensor slice. Supported data types: F16, F32 |
[in] | dst_stride_x | Stride of the destination tensor in X dimension (in bytes) |
[in] | dst_step_x | dst_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | dst_stride_y | Stride of the destination tensor in Y dimension (in bytes) |
[in] | dst_step_y | dst_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | dst_offset_first_element_in_bytes | The offset of the first element in the destination tensor |
[out] | sum_ptr | Pointer to the sum values tensor slice. Supported data types: F16, F32 |
[in] | sum_stride_x | Stride of the sum values tensor in X dimension (in bytes) |
[in] | sum_step_x | sum_stride_x * number of elements along X processed per workitem(in bytes) |
[in] | sum_stride_y | Stride of the sum values tensor in Y dimension (in bytes) |
[in] | sum_step_y | sum_stride_y * number of elements along Y processed per workitem(in bytes) |
[in] | sum_offset_first_element_in_bytes | The offset of the first element in the sum values tensor |
[in] | width | Input image width |
Definition at line 132 of file softmax_layer.cl.
References CONVERT, CONVERT_TO_IMAGE_STRUCT, DATA_TYPE, idx16, offset(), Image::ptr, SELECT_DATA_TYPE, and VEC_DATA_TYPE.
__constant uint16 idx16 = (uint16)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) |
Definition at line 37 of file softmax_layer.cl.
Referenced by softmax_layer_max(), and softmax_layer_shift_exp_sum().
__constant float16 type_min = ( float16 )( FLT_MIN ) |
Definition at line 36 of file softmax_layer.cl.
Referenced by softmax_layer_max().