Added exception when calling forward to specified layer with the new dnn engine

This commit is contained in:
Alexander Lyulkov 2024-10-25 13:00:15 +03:00
parent 9f0c3f5b2b
commit 3a4c88c33e
2 changed files with 5 additions and 2 deletions

View File

@ -1018,8 +1018,8 @@ CV__DNN_INLINE_NS_BEGIN
enum EngineType
{
ENGINE_CLASSIC=1, //!< Force use the new dnn engine. The engine does not support non CPU back-ends for now.
ENGINE_NEW=2, //!< Force use the old dnn engine similar to 4.x branch
ENGINE_CLASSIC=1, //!< Force use the old dnn engine similar to 4.x branch
ENGINE_NEW=2, //!< Force use the new dnn engine. The engine does not support non CPU back-ends for now.
ENGINE_AUTO=3 //!< Try to use the new engine and then fall back to the classic version.
};

View File

@ -1178,6 +1178,9 @@ void Net::Impl::forward(std::vector<std::vector<Mat>>& outputBlobs,
CV_Assert(!empty());
FPDenormalsIgnoreHintScope fp_denormals_ignore_scope;
if (mainGraph)
CV_Error(Error::StsNotImplemented, "The new dnn engine doesn't support inference until a specified layer. If you want to run the whole model, please don't set the outputName argument in the forward() call. If you want to run the model until a specified layer, please use the old dnn engine");
std::vector<LayerPin> pins;
for (int i = 0; i < outBlobNames.size(); i++)
{