|
bitsim
Model, simulate, estimate and control robots in C++
|
A small neural network whose weights are a flat vector of parameters, for EvolutionStrategy. More...
#include <mlp_policy.h>
Public Member Functions | |
| MLPPolicy (std::vector< uint_t > layer_sizes) | |
| uint_t | n_parameters () const noexcept |
| How many parameters the network has. | |
| const std::vector< uint_t > & | layer_sizes () const noexcept |
| std::vector< real_t > | initial_parameters (uint_t seed) const |
| Weights drawn from N(0, 1 / fan_in), biases 0. | |
| std::vector< real_t > | forward (const std::vector< real_t > ¶meters, const std::vector< real_t > &x) const |
| The outputs of the network for observation x with parameters. | |
| uint_t | act_discrete (const std::vector< real_t > ¶meters, const std::vector< real_t > &x) const |
| The output with the largest value: the action of a discrete action space. | |
| std::vector< real_t > | act_continuous (const std::vector< real_t > ¶meters, const std::vector< real_t > &x, real_t scale=1.0) const |
| scale * tanh(outputs): the action of a bounded continuous action space | |
A small neural network whose weights are a flat vector of parameters, for EvolutionStrategy.
The layers have the sizes given, the first the size of the observation and the last the number of outputs; the hidden layers use tanh, and the outputs are linear. The network holds no weights: every call takes them, so one MLPPolicy serves every candidate of a generation, on every thread at once. It needs no libtorch.
The parameters are, layer after layer, the weights row by row (an output's weights over the inputs) and then the biases.
|
inlineexplicit |
|
inline |
scale * tanh(outputs): the action of a bounded continuous action space
|
inline |
The output with the largest value: the action of a discrete action space.
|
inline |
The outputs of the network for observation x with parameters.
|
inline |
Weights drawn from N(0, 1 / fan_in), biases 0.
|
inlinenoexcept |
|
inlinenoexcept |
How many parameters the network has.