serial_cpu.c 598 Bytes
Newer Older
rusty1s's avatar
fixes  
rusty1s committed
1
2
3
4
#ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "generic/serial_cpu.c"
#else

rusty1s's avatar
rusty1s committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void cluster_(serial)(THLongTensor *output, THLongTensor *row, THLongTensor *col, THTensor *weight, THLongTensor *degree) {
  real *weight_data = weight->storage->data + weight->storageOffset;
  real max_weight, w;
  int64_t d, c;
  SERIAL(output, row, col, degree,
    max_weight = 0;
    for (d = 0; d < degree_data[row_value]; d++) {
      c = col_data[e + d];
      w = weight_data[e + d];
      if (output_data[c] < 0 && w >= max_weight) {
        col_value = c;
        max_weight = w;
      }
    }
  )
rusty1s's avatar
fixes  
rusty1s committed
20
21
22
}

#endif