"research/object_detection/evaluator.py" did not exist on "65f0fa2e597127a19f57c1a875f5138891daa359"
THGrid.c 675 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
#ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "generic/THGrid.c"
#else

rusty1s's avatar
rusty1s committed
5
void THGrid_(THLongTensor *cluster, THTensor *pos, THTensor *size, THLongTensor *count) {
rusty1s's avatar
rusty1s committed
6
7
8
9
10
11
12
  int64_t *clusterData = DATA(cluster);
  real *posData = DATA(pos);
  real *sizeData = DATA(size);
  int64_t *countData = DATA(count);

  ptrdiff_t n, d; int64_t coef, value;
  for (n = 0; n < THTensor_(size)(pos, 0); n++) {
rusty1s's avatar
rusty1s committed
13
    coef = 1; value = 0;
rusty1s's avatar
rusty1s committed
14
15
    for (d = 0; d < THTensor_(size)(pos, 1); d++) {
      value += coef * (int64_t) (*(posData + d * pos->stride[1]) / sizeData[d]);
rusty1s's avatar
rusty1s committed
16
17
      coef *= countData[d];
    }
rusty1s's avatar
rusty1s committed
18
19
20
    posData += pos->stride[0];
    clusterData[n] = value;
  }
rusty1s's avatar
rusty1s committed
21
22
23
}

#endif  // TH_GENERIC_FILE