improve maxpooling
@@ -40,9 +40,10 @@ void max_pooling(
{
T_INT row = (wi * p.stride) - p.padding + ki;
T_INT col = (wj * p.stride) - p.padding + kj;
-
T_INT inside = (row >= 0 && col >= 0 && row < (T_INT) p.input_height && col < (T_INT)p.input_width);
- TYPE e = (inside ? input[row * (p.input_width * p.kernel_depth) + col * (p.kernel_depth) + kz] : lowest);
+ if (!inside) continue;
+
+ TYPE e = input[row * (p.input_width * p.kernel_depth) + col * (p.kernel_depth) + kz];
// update the current maximum value found so far
T_UINT index_current_maximum_value = wi * (p.kernel_depth * p.output_width) + wj * (p.kernel_depth) + kz;
@@ -75,10 +76,11 @@ void max_pooling_with_argmax(
{
T_INT height_index = (wi * p.stride) - p.padding + ki;
T_INT width_index = (wj * p.stride) - p.padding + kj;
-
T_INT inside = (height_index >= 0 && width_index >= 0 && height_index < (T_INT) p.input_height && width_index < (T_INT)p.input_width);
+ if (!inside) continue;
+
T_UINT input_index = height_index * (p.input_width * p.kernel_depth) + width_index * (p.kernel_depth) + kz;
- TYPE e = (inside ? input[input_index] : lowest);
+ TYPE e = input[input_index];
// update the current maximum value found so far
T_UINT index_current_maximum_value = wi * (p.kernel_depth * p.output_width) + wj * (p.kernel_depth) + kz;
