Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about kann_apply1 #20

Open
LeavesLei opened this issue Mar 5, 2019 · 1 comment
Open

Questions about kann_apply1 #20

LeavesLei opened this issue Mar 5, 2019 · 1 comment

Comments

@LeavesLei
Copy link

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().

@LeavesLei
Copy link
Author

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;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant