Skip to content

Commit

Permalink
Fix padding dim order to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
lukamac committed Feb 7, 2024
1 parent 70a882c commit 1a28075
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions ne16/hal/ne16_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ void ne16_task_set_padding(ne16_task_t *task, const uint8_t top,
}

void ne16_task_set_mask_filter(ne16_task_t *task, const uint8_t top,
const uint8_t right, const uint8_t bottom,
const uint8_t left) {
const uint8_t bottom, const uint8_t left,
const uint8_t right) {
task->data.cfg.filter_mask = ((top & 0xff) << 24) | ((right & 0xff) << 16) |
((bottom & 0xff) << 8) | ((left & 0xff) << 0);
}
Expand All @@ -219,8 +219,8 @@ void ne16_task_set_dims(ne16_task_t *task, const uint32_t w_in,
const uint32_t h_out_stride,
const uint32_t w_out_stride, const uint8_t padding_top,
const uint8_t padding_bottom,
const uint8_t padding_right,
const uint8_t padding_left) {
const uint8_t padding_left,
const uint8_t padding_right) {
ne16_task_set_strides(task, k_in, h_in_stride, w_in_stride, h_out_stride,
w_out_stride);
ne16_task_set_counters(task, k_in, h_out, w_out, k_out, padding_bottom,
Expand All @@ -235,8 +235,8 @@ void ne16_task_set_dims_stride2x2(
const uint32_t h_out, const uint32_t w_out, const uint32_t k_out,
const uint32_t h_out_stride, const uint32_t w_out_stride,
const uint8_t h_ker, const uint8_t w_ker, const uint8_t padding_top,
const uint8_t padding_bottom, const uint8_t padding_right,
const uint8_t padding_left) {
const uint8_t padding_bottom, const uint8_t padding_left,
const uint8_t padding_right) {
const uint8_t stride = 2;

// WARNING: works only for even output channel stride (divisible by 2)
Expand Down
12 changes: 6 additions & 6 deletions ne16/hal/ne16_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ void ne16_task_set_padding(ne16_task_t *task, const uint8_t top,
const uint8_t bottom, const uint8_t left,
const uint8_t right, const uint8_t value);
void ne16_task_set_mask_filter(ne16_task_t *task, const uint8_t top,
const uint8_t right, const uint8_t bottom,
const uint8_t left);
const uint8_t bottom, const uint8_t left,
const uint8_t right);
/** ne16_task_set_dims
*
* All the strides variables are strides between elements alongside that
Expand All @@ -172,8 +172,8 @@ void ne16_task_set_dims(ne16_task_t *task, const uint32_t w_in,
const uint32_t h_out_stride,
const uint32_t w_out_stride, const uint8_t padding_top,
const uint8_t padding_bottom,
const uint8_t padding_right,
const uint8_t padding_left);
const uint8_t padding_left,
const uint8_t padding_right);
/** ne16_task_set_dims_stride2x2
*
* All the strides variables are strides between elements alongside that
Expand All @@ -186,7 +186,7 @@ void ne16_task_set_dims_stride2x2(
const uint32_t h_out, const uint32_t w_out, const uint32_t k_out,
const uint32_t h_out_stride, const uint32_t w_out_stride,
const uint8_t h_ker, const uint8_t w_ker, const uint8_t padding_top,
const uint8_t padding_bottom, const uint8_t padding_right,
const uint8_t padding_left);
const uint8_t padding_bottom, const uint8_t padding_left,
const uint8_t padding_right);

#endif // !__NE16_TASK_H__
6 changes: 3 additions & 3 deletions neureka/hal/neureka_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ void neureka_task_set_padding(neureka_task_t *task, const uint8_t top,
}

void neureka_task_set_mask_filter(neureka_task_t *task, const uint8_t top,
const uint8_t right, const uint8_t bottom,
const uint8_t left) {
const uint8_t bottom, const uint8_t left,
const uint8_t right) {
task->data.cfg.filter_mask = ((top & 0xff) << 24) | ((right & 0xff) << 16) |
((bottom & 0xff) << 8) | ((left & 0xff) << 0);
}
Expand All @@ -228,7 +228,7 @@ void neureka_task_set_dims(
const uint32_t h_out, const uint32_t w_out, const uint32_t k_out,
const uint32_t h_out_stride, const uint32_t w_out_stride,
const uint8_t padding_top, const uint8_t padding_bottom,
const uint8_t padding_right, const uint8_t padding_left) {
const uint8_t padding_left, const uint8_t padding_right) {
neureka_task_set_strides(task, k_in, h_in_stride, w_in_stride, h_out_stride,
w_out_stride);
neureka_task_set_counters(task, k_in, h_out, w_out, k_out, padding_bottom,
Expand Down
6 changes: 3 additions & 3 deletions neureka/hal/neureka_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ void neureka_task_set_padding(neureka_task_t *task, const uint8_t top,
const uint8_t bottom, const uint8_t left,
const uint8_t right, const uint8_t value);
void neureka_task_set_mask_filter(neureka_task_t *task, const uint8_t top,
const uint8_t right, const uint8_t bottom,
const uint8_t left);
const uint8_t bottom, const uint8_t left,
const uint8_t right);
/** neureka_task_set_dims
*
* All the strides variables are strides between elements alongside that
Expand All @@ -182,6 +182,6 @@ void neureka_task_set_dims(
const uint32_t h_out, const uint32_t w_out, const uint32_t k_out,
const uint32_t h_out_stride, const uint32_t w_out_stride,
const uint8_t padding_top, const uint8_t padding_bottom,
const uint8_t padding_right, const uint8_t padding_left);
const uint8_t padding_left, const uint8_t padding_right);

#endif // !__NEUREKA_TASK_H__
8 changes: 4 additions & 4 deletions test/app/src/nnx_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ static void task_prepare(nnx_task_t *task) {
nnx_task_set_dims_stride2x2(
task, INPUT_HEIGHT, INPUT_WIDTH, INPUT_CHANNEL, h_in_stride, w_in_stride,
OUTPUT_HEIGHT, OUTPUT_WIDTH, OUTPUT_CHANNEL, h_out_stride, w_out_stride,
WEIGHT_HEIGHT, WEIGHT_WIDTH, PADDING_TOP, PADDING_BOTTOM, PADDING_RIGHT,
PADDING_LEFT);
WEIGHT_HEIGHT, WEIGHT_WIDTH, PADDING_TOP, PADDING_BOTTOM, PADDING_LEFT,
PADDING_RIGHT);
#else
nnx_task_set_dims(task, INPUT_WIDTH, INPUT_CHANNEL, h_in_stride, w_in_stride,
OUTPUT_HEIGHT, OUTPUT_WIDTH, OUTPUT_CHANNEL, h_out_stride,
w_out_stride, PADDING_TOP, PADDING_BOTTOM, PADDING_RIGHT,
PADDING_LEFT);
w_out_stride, PADDING_TOP, PADDING_BOTTOM, PADDING_LEFT,
PADDING_RIGHT);
#endif

nnx_task_set_ptrs(task, (uint32_t)input, INPUT_WIDTH, w_in_stride,
Expand Down

0 comments on commit 1a28075

Please sign in to comment.