"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "e44b205e0ba33cf29cacbe8766d21d510d2d1ef7"
Unverified Commit 77e6255f authored by Adrià Arrufat's avatar Adrià Arrufat Committed by GitHub
Browse files

Add error message for mismatched tensor sizes in dnn_trainer (#2165)

parent 40c3e488
...@@ -764,7 +764,12 @@ namespace dlib ...@@ -764,7 +764,12 @@ namespace dlib
{ {
std::vector<tensor*> temp(all_tensors.size()); std::vector<tensor*> temp(all_tensors.size());
for (size_t j = 0; j < all_tensors.size(); ++j) for (size_t j = 0; j < all_tensors.size(); ++j)
{
temp[j] = all_tensors[j][i]; temp[j] = all_tensors[j][i];
DLIB_CASSERT(temp[0]->size() == temp[j]->size(),
"Make sure you don't modify the network structure "
"or number of parameters after constructing the trainer.");
}
// ignore layers that don't have parameters // ignore layers that don't have parameters
if (temp[0]->size() != 0) if (temp[0]->size() != 0)
averagers[i].set(temp); averagers[i].set(temp);
......
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