Changeset 3cbcc40


Ignore:
Timestamp:
Dec 29, 2021, 5:51:48 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe
Children:
4d452fb
Parents:
6c39d11
git-author:
Paul Brossier <piem@piem.org> (01/08/19 00:06:02)
git-committer:
Paul Brossier <piem@piem.org> (12/29/21 17:51:48)
Message:

[maxpool2d] use first element to initialize output value, add stride

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ai/maxpool2d.c

    r6c39d11 r3cbcc40  
    102102      for (k = 0; k < output_tensor->shape[2]; k++)
    103103      {
    104         smpl_t m = -10000.;
     104        uint_t stride_i = i * c->pool_size[0];
     105        uint_t stride_j = j * c->pool_size[1];
     106        smpl_t m = input_tensor->data[stride_i][stride_j
     107          * input_tensor->shape[2] + k];
    105108        for (a = 0; a < c->pool_size[0]; a++) {
    106109          for (b = 0; b < c->pool_size[1]; b++) {
    107             uint_t idx = (j * c->pool_size[1] + b) * input_tensor->shape[2] + k;
    108             m = MAX(m, input_tensor->data[i * c->pool_size[0] + a][idx]);
     110            uint_t idx = (stride_j + b) * input_tensor->shape[2] + k;
     111            m = MAX(m, input_tensor->data[stride_i + a][idx]);
    109112          }
    110113        }
Note: See TracChangeset for help on using the changeset viewer.