Commit adc022c7 authored by Davis King's avatar Davis King

code cleanup

parent 437da23e
...@@ -261,16 +261,13 @@ namespace dlib ...@@ -261,16 +261,13 @@ namespace dlib
dlib::rand& rnd dlib::rand& rnd
) )
{ {
float* data = params.host(); for (auto& val : params)
for (size_t i = 0; i < params.size(); ++i)
{ {
// Draw a random number to initialize the layer according to formula (16) // Draw a random number to initialize the layer according to formula (16)
// from Understanding the difficulty of training deep feedforward neural // from Understanding the difficulty of training deep feedforward neural
// networks by Xavier Glorot and Yoshua Bengio. // networks by Xavier Glorot and Yoshua Bengio.
float val = 2*rnd.get_random_float()-1; val = 2*rnd.get_random_float()-1;
val *= std::sqrt(6.0/(num_inputs_and_outputs)); val *= std::sqrt(6.0/(num_inputs_and_outputs));
data[i] = val;
} }
} }
......
Markdown is supported
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