mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Implement simple model validation
This commit is contained in:
@@ -147,4 +147,23 @@ void Model::loadWeights(const std::string& path) {
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
bool Model::validate() {
|
||||
|
||||
bool valid = true;
|
||||
int size = inputLayer->getInputSize();
|
||||
|
||||
for (const auto& layer : layers) {
|
||||
if (layer.second->getInputSize() != size) {
|
||||
valid = false;
|
||||
std::cerr << "Layer: " << layer.first << " has incorrect input size, expected " << size << " but got "
|
||||
<< layer.second->getInputSize() << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
size = layer.second->getOutputSize();
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
Reference in New Issue
Block a user