Commit 7474abd7 authored by Davis King's avatar Davis King

Changed the mean squared loss layers to return a loss that's the MSE, not

0.5*MSE.  The only thing this effects is the logging messages that print during
training, which were confusing since the reported loss was half the size you
would expect.
parent ca9fceb2
...@@ -1641,7 +1641,7 @@ namespace dlib ...@@ -1641,7 +1641,7 @@ namespace dlib
const float y = *truth++; const float y = *truth++;
const float temp1 = y - out_data[i]; const float temp1 = y - out_data[i];
const float temp2 = scale*temp1; const float temp2 = scale*temp1;
loss += 0.5*temp2*temp1; loss += temp2*temp1;
g[i] = -temp2; g[i] = -temp2;
} }
...@@ -1758,7 +1758,7 @@ namespace dlib ...@@ -1758,7 +1758,7 @@ namespace dlib
const float y = ytrue(j, 0); const float y = ytrue(j, 0);
const float temp1 = y - *out_data++; const float temp1 = y - *out_data++;
const float temp2 = scale*temp1; const float temp2 = scale*temp1;
loss += 0.5*temp2*temp1; loss += temp2*temp1;
*g = -temp2; *g = -temp2;
++g; ++g;
} }
...@@ -2201,7 +2201,7 @@ namespace dlib ...@@ -2201,7 +2201,7 @@ namespace dlib
const size_t idx = tensor_index(output_tensor, i, 0, r, c); const size_t idx = tensor_index(output_tensor, i, 0, r, c);
const float temp1 = y - out_data[idx]; const float temp1 = y - out_data[idx];
const float temp2 = scale*temp1; const float temp2 = scale*temp1;
loss += 0.5*temp2*temp1; loss += temp2*temp1;
g[idx] = -temp2; g[idx] = -temp2;
} }
} }
......
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