From 10aee918c0bd22f8529cafb8b3719b819c06b87d Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 24 May 2017 14:05:36 +0300 Subject: [PATCH] Fix DNN module build without torch --- modules/dnn/src/torch/torch_importer.cpp | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/dnn/src/torch/torch_importer.cpp b/modules/dnn/src/torch/torch_importer.cpp index 803c80bd0f..023ddc0760 100644 --- a/modules/dnn/src/torch/torch_importer.cpp +++ b/modules/dnn/src/torch/torch_importer.cpp @@ -971,6 +971,22 @@ Mat readTorchBlob(const String &filename, bool isBinary) return importer->tensors.begin()->second; } +#else + +Ptr createTorchImporter(const String&, bool) +{ + CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build"); + return Ptr(); +} + +Mat readTorchBlob(const String&, bool) +{ + CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build"); + return Mat(); +} + +#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER + Net readNetFromTorch(const String &model, bool isBinary) { Ptr importer; @@ -988,20 +1004,5 @@ Net readNetFromTorch(const String &model, bool isBinary) return net; } -#else - -Ptr createTorchImporter(const String&, bool) -{ - CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build"); - return Ptr(); -} - -Mat readTorchBlob(const String&, bool) -{ - CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build"); - return Mat(); -} - -#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER } }