Commit 9cb6266f authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Do not rely on rand

parent 13506dea
Pipeline #188021 passed with stages
in 16 minutes and 51 seconds
......@@ -97,8 +97,12 @@ julien_alloc (size_t dim_input, size_t dim_output, size_t n_hidden,
initial_value = 1.0 / n_parameters;
for (i = 0; i < n_parameters; i++)
{
double ampl = rand () / (RAND_MAX + 1.0);
ret->parameters[i] = (ampl * 2 - 1) * initial_value;
double sign = 1;
if (i % 3 == 0)
{
sign = -1;
}
ret->parameters[i] = sign * initial_value;
}
n_activations += count_hidden_neurons (ret);
ret->forward = xmalloc (n_activations * sizeof (double));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment