Commit 06bda58a authored by Hamdi Sahloul's avatar Hamdi Sahloul

DNN Torch - workaround when torch importer is disabled

parent 3921fab2
......@@ -1198,6 +1198,16 @@ Mat readTorchBlob(const String &filename, bool isBinary)
return importer->tensors.begin()->second;
}
Net readNetFromTorch(const String &model, bool isBinary)
{
CV_TRACE_FUNCTION();
TorchImporter importer(model, isBinary);
Net net;
importer.populateNet(net);
return net;
}
#else
Ptr<Importer> createTorchImporter(const String&, bool)
......@@ -1212,17 +1222,13 @@ Mat readTorchBlob(const String&, bool)
return Mat();
}
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
Net readNetFromTorch(const String &model, bool isBinary)
{
CV_TRACE_FUNCTION();
TorchImporter importer(model, isBinary);
Net net;
importer.populateNet(net);
return net;
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
return Net();
}
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
CV__DNN_EXPERIMENTAL_NS_END
}} // namespace
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