Skip to content

Commit ba7c839

Browse files
benizsileht
authored andcommitted
fix: tensorrt output layer lookup now throws when layer does not exist
1 parent 9edf1d4 commit ba7c839

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backends/tensorrt/tensorrtlib.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ namespace dd
298298
throw MLLibInternalException("Error while parsing caffe model "
299299
"for conversion to TensorRT");
300300

301-
network->markOutput(*blobNameToTensor->find(out_blob.c_str()));
301+
auto bloboutput = blobNameToTensor->find(out_blob.c_str());
302+
if (!bloboutput)
303+
throw MLLibBadParamException("Cannot find output layer " + out_blob);
304+
network->markOutput(*bloboutput);
302305

303306
if (out_blob == "detection_out")
304307
network->markOutput(*blobNameToTensor->find("keep_count"));

0 commit comments

Comments
 (0)