Open LeavesLei opened 5 years ago
this is my whole network code:
int main() { kad_node_t *t; t = kad_feed(3, batch_size, input_steps, n_inputs); t = kad_relu(kann_layer_conv1d(t, 512, 3, 1, 1)); t = kad_relu(kann_layer_conv1d(t, 512, 3, 1, 1)); t = kann_layer_conv1d(t, 3, 1, 1, 1); t = kad_sigm(t);
kann_t *ann;
int batch_size = 100 // number of training samples
float xx[batch_size][100][400];
float yy[batch_size][100][3];
ann = kann_new(kann_layer_cost(t, 3, KANN_C_CEM), 0);
float **x = (float **)xx;
float **y = (float **)yy;
kann_train_fnn1(ann, lr, batch_size, epoch, max_drop_streak, frac_val, n, x, y);
const float *y1;
y1 = kann_apply1(ann, x[0]); // this word called a error!
cout << *y1 << endl;
kann_delete(ann);
return 0;
}
Hi, I am a fresh guy in C++. My code had a bug when I used the libaray. this is my input and label:
float xx[1][100][400]; float yy[1][100][3]; float x = (float )xx; float y = (float )yy;
and then train the net:
kann_train_fnn1(ann, lr, batch_size, epoch, max_drop_streak, frac_val, 1, x, y);
when I tried to test the net, it's something wrong:
auto y1 = kann_apply1(ann, x->x[0]); // It caused a error here.
BTW, I didn't save the model between executing kann_train_fnn1() and kann_apply1().