26 #if defined(WIDTH) && defined(HEIGHT) && defined(DEPTH) 44 __kernel
void minmax_layer(
51 float4 min_value = (float4)FLT_MAX;
52 float4 max_value = (float4) - FLT_MAX;
53 float2 min_max_value = (float2)(FLT_MAX, -FLT_MAX);
55 for(
int z = 0; z < DEPTH; ++z)
57 for(
int y = 0; y <
HEIGHT; ++y)
60 __global
float *src_addr = (__global
float *)(src.
ptr + y * src_stride_y + z * src_stride_z);
62 for(; x <= (int)(WIDTH - 8); x += 8)
64 float8 value = *(src_addr + x);
66 min_value =
select(value.s0123, min_value, min_value < value.s0123);
67 min_value =
select(value.s4567, min_value, min_value < value.s4567);
69 max_value =
select(value.s0123, max_value, max_value > value.s0123);
70 max_value =
select(value.s4567, max_value, max_value > value.s4567);
75 float value = *(src_addr + x);
77 min_max_value.s0 = min(min_max_value.s0, value);
78 min_max_value.s1 = max(min_max_value.s1, value);
84 min_value.s01 = min(min_value.s01, min_value.s23);
85 min_value.s0 = min(min_value.s0, min_value.s1);
86 max_value.s01 = max(max_value.s01, max_value.s23);
87 max_value.s0 = max(max_value.s0, max_value.s1);
89 min_max_value.s0 = min(min_max_value.s0, min_value.s0);
90 min_max_value.s1 = max(min_max_value.s1, max_value.s0);
92 if(min_max_value.s0 == min_max_value.s1)
94 min_max_value.s0 = 0.0f;
95 min_max_value.s1 = 1.0f;
99 vstore2(min_max_value, 0, (__global
float *)dst.
ptr);
101 #endif // defined(WIDTH) && defined(HEIGHT) && defined(DEPTH) Structure to hold Vector information.
Structure to hold 3D tensor information.
SimpleTensor< float > src
#define CONVERT_TO_VECTOR_STRUCT(name)
#define VECTOR_DECLARATION(name)
__global uchar * ptr
Pointer to the starting postion of the buffer.
#define CONVERT_TO_TENSOR3D_STRUCT(name)
SimpleTensor< T > select(const SimpleTensor< uint8_t > &c, const SimpleTensor< T > &x, const SimpleTensor< T > &y)
__global uchar * ptr
Pointer to the starting postion of the buffer.
#define TENSOR3D_DECLARATION(name)