mirror of
https://github.com/glouw/tinn
synced 2024-11-21 22:11:21 +03:00
43 lines
782 B
C
43 lines
782 B
C
#pragma once
|
|
|
|
typedef struct
|
|
{
|
|
// All the weights.
|
|
float* w;
|
|
// Hidden to output layer weights.
|
|
float* x;
|
|
// Biases.
|
|
float* b;
|
|
// Hidden layer.
|
|
float* h;
|
|
// Output layer.
|
|
float* o;
|
|
|
|
// Number of biases - always two - Tinn only supports a single hidden layer.
|
|
int nb;
|
|
// Number of weights.
|
|
int nw;
|
|
|
|
// Number of inputs.
|
|
int nips;
|
|
// Number of hidden neurons.
|
|
int nhid;
|
|
// Number of outputs.
|
|
int nops;
|
|
}
|
|
Tinn;
|
|
|
|
float* xtpredict(Tinn, const float* in);
|
|
|
|
float xttrain(Tinn, const float* in, const float* tg, float rate);
|
|
|
|
Tinn xtbuild(int nips, int nhid, int nops);
|
|
|
|
void xtsave(Tinn, const char* path);
|
|
|
|
Tinn xtload(const char* path);
|
|
|
|
void xtfree(Tinn);
|
|
|
|
void xtprint(const float* arr, const int size);
|