Skip to content

Commit

Permalink
Fix DNN module build without torch
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov committed May 24, 2017
1 parent 503b00f commit 10aee91
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions modules/dnn/src/torch/torch_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,22 @@ Mat readTorchBlob(const String &filename, bool isBinary)
return importer->tensors.begin()->second;
}

#else

Ptr<Importer> createTorchImporter(const String&, bool)
{
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
return Ptr<Importer>();
}

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> importer;
Expand All @@ -988,20 +1004,5 @@ Net readNetFromTorch(const String &model, bool isBinary)
return net;
}

#else

Ptr<Importer> createTorchImporter(const String&, bool)
{
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
return Ptr<Importer>();
}

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
}
}

0 comments on commit 10aee91

Please sign in to comment.