Skip to content

Commit 8fd73a4

Browse files
authored
Merge pull request #33 from fps/assert_fix
Ust std::runtime_error instead of assert to signal wrong number of weights
2 parents 6e5574d + 31ffaa5 commit 8fd73a4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

NeuralAudio/WaveNet.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,12 @@ namespace NeuralAudio
371371

372372
headScale = *(it++);
373373

374-
assert(std::distance(weights.begin(), it) == (long)weights.size());
374+
if (std::distance(weights.begin(), it) != (long)weights.size())
375+
{
376+
std::stringstream str;
377+
str << "Wrong number of weights. Remaining: " << std::distance(weights.begin(), it);
378+
throw std::runtime_error(str.str());
379+
}
375380
}
376381

377382
size_t GetMaxFrames()
@@ -439,4 +444,4 @@ namespace NeuralAudio
439444
Eigen::Matrix<float, headLayerChannels, WAVENET_MAX_NUM_FRAMES> headArray;
440445
float headScale;
441446
};
442-
}
447+
}

0 commit comments

Comments
 (0)