|
micrograd 0.1.0
Small C implementation of micrograd
|
Fully connected neuron construction, evaluation, and parameters. More...
Data Structures | |
| struct | mg_neuron |
| Fully connected neuron in a neural network. More... | |
Functions | |
| bool | mg_neuron_init (mg_graph *g, mg_neuron *n, size_t nin, bool non_linear) |
| Initialize a neuron. | |
| void | mg_neuron_free (mg_neuron *n) |
| Free memory owned by a neuron. | |
| mg_value * | mg_neuron_call (mg_graph *g, mg_neuron *n, mg_value **x) |
| Evaluate a neuron with the given input values. | |
| size_t | mg_neuron_param_count (const mg_neuron *n) |
| Get the number of trainable parameters in a neuron. | |
| void | mg_neuron_params (const mg_neuron *n, mg_value **out) |
| Copy a neuron's parameters into a flat array. | |
Fully connected neuron construction, evaluation, and parameters.
Evaluate a neuron with the given input values.
On failure, the graph is left unchanged.
| g | Graph that owns any intermediate and output values. |
| n | Neuron to evaluate. |
| x | Array of n->n_in input values. |
NULL on invalid input or allocation failure. | void mg_neuron_free | ( | mg_neuron * | n | ) |
Free memory owned by a neuron.
| n | Neuron to free. |
Initialize a neuron.
| g | Graph that owns the neuron's values. |
| n | Neuron to initialize. |
| nin | Number of input values. |
| non_linear | Whether to apply the non-linear activation function. |
true on success, false on allocation failure. | size_t mg_neuron_param_count | ( | const mg_neuron * | n | ) |
Get the number of trainable parameters in a neuron.
| n | Neuron to inspect. |