未验证 提交 eef98b7f 编写于 作者: P Pei Yang 提交者: GitHub

add macro check for using TRT api dynamicRangeIsSet() (#25694)

上级 4dff426e
...@@ -124,6 +124,7 @@ void TensorRTEngine::FreezeNetwork() { ...@@ -124,6 +124,7 @@ void TensorRTEngine::FreezeNetwork() {
<< ", this might be ok when trt does not need this range"; << ", this might be ok when trt does not need this range";
} }
} }
#if IS_TRT_VERSION_GE(5122)
auto is_layer_int8 = [&](nvinfer1::ILayer *layer) -> bool { auto is_layer_int8 = [&](nvinfer1::ILayer *layer) -> bool {
for (int j = 0; j < layer->getNbInputs(); j++) { for (int j = 0; j < layer->getNbInputs(); j++) {
auto *temp_in = layer->getInput(j); auto *temp_in = layer->getInput(j);
...@@ -161,6 +162,11 @@ void TensorRTEngine::FreezeNetwork() { ...@@ -161,6 +162,11 @@ void TensorRTEngine::FreezeNetwork() {
layer->setPrecision(nvinfer1::DataType::kFLOAT); layer->setPrecision(nvinfer1::DataType::kFLOAT);
} }
} }
#else
LOG(WARNING) << "If your TensorRT version is lower than 5.1.2.2, you "
"must provide quantization scales for all tensors using "
"TRT to run.";
#endif
#endif #endif
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册