Skip to content

Commit 10aee91

Browse files
committed
Fix DNN module build without torch
1 parent 503b00f commit 10aee91

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

modules/dnn/src/torch/torch_importer.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,22 @@ Mat readTorchBlob(const String &filename, bool isBinary)
971971
return importer->tensors.begin()->second;
972972
}
973973

974+
#else
975+
976+
Ptr<Importer> createTorchImporter(const String&, bool)
977+
{
978+
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
979+
return Ptr<Importer>();
980+
}
981+
982+
Mat readTorchBlob(const String&, bool)
983+
{
984+
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
985+
return Mat();
986+
}
987+
988+
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
989+
974990
Net readNetFromTorch(const String &model, bool isBinary)
975991
{
976992
Ptr<Importer> importer;
@@ -988,20 +1004,5 @@ Net readNetFromTorch(const String &model, bool isBinary)
9881004
return net;
9891005
}
9901006

991-
#else
992-
993-
Ptr<Importer> createTorchImporter(const String&, bool)
994-
{
995-
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
996-
return Ptr<Importer>();
997-
}
998-
999-
Mat readTorchBlob(const String&, bool)
1000-
{
1001-
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
1002-
return Mat();
1003-
}
1004-
1005-
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
10061007
}
10071008
}

0 commit comments

Comments
 (0)