Changeset 7420c40


Ignore:
Timestamp:
Jan 8, 2019, 12:06:02 AM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn_org, feature/crepe_org
Children:
8691154
Parents:
f9f03ff
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ai/maxpool2d.c

    rf9f03ff r7420c40  
    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.