From 97985d4c13e30e3fb5e984edfc1f9b46a0b612fd Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 1 Jan 2019 18:39:56 +0100 Subject: [PATCH] [maxpool1d] update to new tensor members --- src/ai/maxpool1d.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ai/maxpool1d.c b/src/ai/maxpool1d.c index 2688b8ef..f171faca 100644 --- a/src/ai/maxpool1d.c +++ b/src/ai/maxpool1d.c @@ -59,11 +59,11 @@ void aubio_maxpool1d_debug(aubio_maxpool1d_t *c, aubio_tensor_t *input_tensor) { AUBIO_DBG("maxpool1d: input (%d, %d) ¤ maxpool1d (pool_size = (%d)) ->" " (%d, %d) (no params)\n", - input_tensor->dims[0], - input_tensor->dims[1], + input_tensor->shape[0], + input_tensor->shape[1], c->pool_size, - input_tensor->dims[0] / c->pool_size, - input_tensor->dims[1]); + input_tensor->shape[0] / c->pool_size, + input_tensor->shape[1]); } uint_t aubio_maxpool1d_get_output_shape(aubio_maxpool1d_t *c, @@ -72,8 +72,8 @@ uint_t aubio_maxpool1d_get_output_shape(aubio_maxpool1d_t *c, AUBIO_ASSERT(c); AUBIO_ASSERT(shape && sizeof(shape) == 2*sizeof(uint_t)); AUBIO_ASSERT(input); - shape[0] = input->dims[0] / c->pool_size; - shape[1] = input->dims[1]; + shape[0] = input->shape[0] / c->pool_size; + shape[1] = input->shape[1]; aubio_maxpool1d_debug(c, input); @@ -86,8 +86,10 @@ void aubio_maxpool1d_do(aubio_maxpool1d_t *c, aubio_tensor_t *input_tensor, uint_t i, j, a; AUBIO_ASSERT(c && input_tensor && output_tensor); - for (j = 0; j < output_tensor->dims[1]; j++) { - for (i = 0; i < output_tensor->dims[0]; i++) { + //aubio_maxpool1d_debug(c, input_tensor); + + for (j = 0; j < output_tensor->shape[1]; j++) { + for (i = 0; i < output_tensor->shape[0]; i++) { smpl_t m = -FLT_MAX; for (a = 0; a < c->pool_size; a++) { m = MAX(m, input_tensor->data[i * c->pool_size + a][j]); -- 2.11.0