Changeset 40642 for trunk/Ohana/src/opihi/cmd.data/nnet_train.c
- Timestamp:
- Mar 18, 2019, 5:02:59 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/nnet_train.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/nnet_train.c
r40371 r40642 3 3 // these are local only 4 4 float nnet_sigmoid (float value); 5 void nnet_sortseq (float *X, int *Y, int N);6 5 int nnet_onelayer (Nnet *nnet, int L); 7 6 void nnet_reset_Nabla (Nnet *nnet); … … 191 190 // generate a random sequence : used to select random mini batches 192 191 for (int i = 0; i < Ntrial; i++) { seq[i] = i; rnd[i] = drand48(); } 193 nnet_sortseq(rnd, seq, Ntrial);192 sort_float_index (rnd, seq, Ntrial); 194 193 195 194 int Npass = Ntrial / Nmini; … … 514 513 return 1.0 / (1.0 + exp(-value)); 515 514 } 516 517 void nnet_sortseq (float *X, int *Y, int N) {518 519 # define SWAPFUNC(A,B){ float ftmp; int itmp; \520 ftmp = X[A]; X[A] = X[B]; X[B] = ftmp; \521 itmp = Y[A]; Y[A] = Y[B]; Y[B] = itmp; \522 }523 # define COMPARE(A,B)(X[A] < X[B])524 525 OHANA_SORT (N, COMPARE, SWAPFUNC);526 527 # undef SWAPFUNC528 # undef COMPARE529 530 }531
Note:
See TracChangeset
for help on using the changeset viewer.
