Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions c/tensorNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ bool tensorNet::ProfileModel(const std::string& deployFile, // name for caf
//parser->destroy();
}
#if NV_TENSORRT_MAJOR >= 5
else if( mModelType == MODEL_ONNX )
else if( inputDims[0].nbDims == 4 )
{
#if NV_TENSORRT_MAJOR >= 7
network->destroy();
Expand Down Expand Up @@ -714,7 +714,7 @@ bool tensorNet::ProfileModel(const std::string& deployFile, // name for caf
nvinfer1::Dims dims = network->getInput(i)->getDimensions();

#if NV_TENSORRT_MAJOR >= 7
if( mModelType == MODEL_ONNX )
if( dims.nbDims == 4 )
dims = shiftDims(dims); // change NCHW to CHW for EXPLICIT_BATCH
#endif

Expand Down Expand Up @@ -1100,15 +1100,15 @@ bool tensorNet::LoadNetwork( const char* prototxt_path_, const char* model_path_
}
else if( model_fmt == MODEL_ENGINE )
{
mModelType = model_fmt;
mModelPath = model_path;

if( !LoadEngine(model_path.c_str(), input_blobs, output_blobs, NULL, device, stream) )
{
LogError(LOG_TRT "failed to load %s\n", model_path.c_str());
return false;
}

mModelType = model_fmt;
mModelPath = model_path;

LogSuccess(LOG_TRT "device %s, initialized %s\n", deviceTypeToStr(device), mModelPath.c_str());
return true;
}
Expand Down Expand Up @@ -1385,7 +1385,7 @@ bool tensorNet::LoadEngine( nvinfer1::ICudaEngine* engine,
nvinfer1::Dims inputDims = validateDims(engine->getBindingDimensions(inputIndex));

#if NV_TENSORRT_MAJOR >= 7
if( mModelType == MODEL_ONNX )
if( inputDims.nbDims == 4 )
inputDims = shiftDims(inputDims); // change NCHW to CHW if EXPLICIT_BATCH set
#endif
#else
Expand Down Expand Up @@ -1449,7 +1449,7 @@ bool tensorNet::LoadEngine( nvinfer1::ICudaEngine* engine,
nvinfer1::Dims outputDims = validateDims(engine->getBindingDimensions(outputIndex));

#if NV_TENSORRT_MAJOR >= 7
if( mModelType == MODEL_ONNX )
if( outputDims.nbDims == 4 )
outputDims = shiftDims(outputDims); // change NCHW to CHW if EXPLICIT_BATCH set
#endif
#else
Expand Down