Changeset 6627c87


Ignore:
Timestamp:
Dec 29, 2021, 5:52:01 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe
Children:
11e6f7a
Parents:
8429515
git-author:
Paul Brossier <piem@piem.org> (01/29/19 03:00:01)
git-committer:
Paul Brossier <piem@piem.org> (12/29/21 17:52:01)
Message:

[conv1d] use array for stride_shape to match conv2d api

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ai/conv1d.c

    r8429515 r6627c87  
    3636  uint_t n_filters;
    3737  uint_t kernel_shape;     // kernel sizes
    38   uint_t stride_shape;     // stride sizes
     38  uint_t stride_shape[1];  // stride sizes
    3939
    4040  aubio_conv1d_padding_type padding_mode;
     
    9898{
    9999  if ((sint_t)stride[0] < 1) return AUBIO_FAIL;
    100   c->stride_shape = stride[0];
     100  c->stride_shape[0] = stride[0];
    101101  return AUBIO_OK;
    102102}
    103103
    104 uint_t aubio_conv1d_get_stride(aubio_conv1d_t *c)
     104uint_t *aubio_conv1d_get_stride(aubio_conv1d_t *c)
    105105{
    106106  return c->stride_shape;
     
    127127      // compute output shape
    128128      output_shape[0] = (uint_t)CEIL(input_tensor->shape[0]
    129           / (smpl_t)c->stride_shape);
    130 
    131       padding_shape = (output_shape[0] - 1) * c->stride_shape +
     129          / (smpl_t)c->stride_shape[0]);
     130
     131      padding_shape = (output_shape[0] - 1) * c->stride_shape[0] +
    132132        c->kernel_shape - input_tensor->shape[0];
    133133
     
    136136    case PAD_VALID:
    137137      output_shape[0] = (input_tensor->shape[0] - c->kernel_shape + 1)
    138         / c->stride_shape;
     138        / c->stride_shape[0];
    139139
    140140      padding_start = 0;
     
    193193    n_params,
    194194    c->kernel->shape[0], c->kernel->shape[1], c->kernel->shape[2],
    195     c->stride_shape,
     195    c->stride_shape[0],
    196196    -c->padding_start);
    197197}
     
    262262        }
    263263      }
    264       stride_a += c->stride_shape;
     264      stride_a += c->stride_shape[0];
    265265      // apply bias
    266266      activations->data[j][i] = acc + bias;
     
    285285
    286286  uint_t sdot_size = c->kernel->shape[0] * c->kernel->shape[1];
    287   uint_t input_stride = c->stride_shape * c->padded_input->shape[1];
     287  uint_t input_stride = c->stride_shape[0] * c->padded_input->shape[1];
    288288
    289289  AUBIO_ASSERT(c && input_tensor && activations);
Note: See TracChangeset for help on using the changeset viewer.