Skip to content

Commit bafdc44

Browse files
committed
Merge pull request opencv#10061 from Sahloul:dnn_torch_fix
2 parents 1af16af + 06bda58 commit bafdc44

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

modules/dnn/src/torch/torch_importer.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,16 @@ Mat readTorchBlob(const String &filename, bool isBinary)
11981198
return importer->tensors.begin()->second;
11991199
}
12001200

1201+
Net readNetFromTorch(const String &model, bool isBinary)
1202+
{
1203+
CV_TRACE_FUNCTION();
1204+
1205+
TorchImporter importer(model, isBinary);
1206+
Net net;
1207+
importer.populateNet(net);
1208+
return net;
1209+
}
1210+
12011211
#else
12021212

12031213
Ptr<Importer> createTorchImporter(const String&, bool)
@@ -1212,17 +1222,13 @@ Mat readTorchBlob(const String&, bool)
12121222
return Mat();
12131223
}
12141224

1215-
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
1216-
12171225
Net readNetFromTorch(const String &model, bool isBinary)
12181226
{
1219-
CV_TRACE_FUNCTION();
1220-
1221-
TorchImporter importer(model, isBinary);
1222-
Net net;
1223-
importer.populateNet(net);
1224-
return net;
1227+
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
1228+
return Net();
12251229
}
12261230

1231+
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
1232+
12271233
CV__DNN_EXPERIMENTAL_NS_END
12281234
}} // namespace

0 commit comments

Comments
 (0)