Neural network layer construction, evaluation, and parameters.
More...
Neural network layer construction, evaluation, and parameters.
◆ mg_layer_call()
Evaluate a layer with the given input values.
- Parameters
-
| g | Graph that owns any intermediate and output values. |
| l | Layer to evaluate. |
| x | Array of l->n_in input values. |
| out | Output array with at least l->n_out entries. |
- Returns
true on success, false on invalid input or allocation failure.
◆ mg_layer_free()
Free memory owned by a layer.
- Parameters
-
◆ mg_layer_init()
| bool mg_layer_init |
( |
mg_graph * |
g, |
|
|
mg_layer * |
l, |
|
|
size_t |
n_in, |
|
|
size_t |
n_out, |
|
|
bool |
non_linear |
|
) |
| |
Initialize a layer.
- Parameters
-
| g | Graph that owns the layer's values. |
| l | Layer to initialize. |
| n_in | Number of input values consumed by each neuron. |
| n_out | Number of output values produced by the layer. |
| non_linear | Whether each neuron should use a non-linear activation function. |
- Returns
true on success, false on allocation failure.
◆ mg_layer_param_count()
| size_t mg_layer_param_count |
( |
const mg_layer * |
l | ) |
|
Get the number of trainable parameters in a layer.
- Parameters
-
- Returns
- Total number of parameters across all neurons.
◆ mg_layer_params()
Copy a layer's parameters into a flat array.
- Parameters
-
| l | Layer to inspect. |
| out | Output array with at least mg_layer_param_count(l) entries. |