|
micrograd 0.1.0
Small C implementation of micrograd
|
Multi-layer perceptron construction, evaluation, and parameters. More...
Data Structures | |
| struct | mg_mlp |
| Multi-layer perceptron model. More... | |
Functions | |
| bool | mg_mlp_init (mg_graph *g, mg_mlp *m, size_t n_in, const size_t *sizes, size_t n_sizes) |
| Initialize an MLP model. | |
| bool | mg_mlp_call (mg_graph *g, mg_mlp *m, mg_value **x, mg_value **out) |
| Evaluate an MLP model. | |
| void | mg_mlp_free (mg_mlp *m) |
| Free memory owned by an MLP model. | |
| size_t | mg_mlp_param_count (const mg_mlp *m) |
| Get the number of trainable parameters in an MLP model. | |
| void | mg_mlp_params (const mg_mlp *m, mg_value **out) |
| Copy an MLP model's parameters into a flat array. | |
Multi-layer perceptron construction, evaluation, and parameters.
Evaluate an MLP model.
Calls each layer in the model sequentially.
| g | Graph that owns any intermediate and output values. |
| m | Model to evaluate. |
| x | Array of input values. |
| out | Output array with enough entries for the final layer. |
true on success, false on invalid input or allocation failure. | void mg_mlp_free | ( | mg_mlp * | m | ) |
Free memory owned by an MLP model.
| m | Model to free. |
Initialize an MLP model.
| g | Graph that owns the model's values. |
| m | Model to initialize. |
| n_in | Number of input features. |
| sizes | Array containing each layer's output size. |
| n_sizes | Number of entries in sizes. |
true on success, false on allocation failure. | size_t mg_mlp_param_count | ( | const mg_mlp * | m | ) |
Get the number of trainable parameters in an MLP model.
| m | Model to inspect. |