Skip to content

Commit

Permalink
fix(tensorrt_common): fix shadowVariable (#7906)
Browse files Browse the repository at this point in the history
* fix:shadowVariable

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:shadowVariable

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

---------

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
  • Loading branch information
kobayu858 authored Jul 10, 2024
1 parent defce44 commit b1d7fcd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions common/tensorrt_common/src/tensorrt_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,18 +427,18 @@ bool TrtCommon::buildEngineFromOnnx(
layer->setPrecision(nvinfer1::DataType::kHALF);
std::cout << "Set kHALF in " << name << std::endl;
}
for (int i = num - 1; i >= 0; i--) {
nvinfer1::ILayer * layer = network->getLayer(i);
auto layer_type = layer->getType();
std::string name = layer->getName();
if (layer_type == nvinfer1::LayerType::kCONVOLUTION) {
layer->setPrecision(nvinfer1::DataType::kHALF);
std::cout << "Set kHALF in " << name << std::endl;
for (int j = num - 1; j >= 0; j--) {
nvinfer1::ILayer * inner_layer = network->getLayer(j);
auto inner_layer_type = inner_layer->getType();
std::string inner_name = inner_layer->getName();
if (inner_layer_type == nvinfer1::LayerType::kCONVOLUTION) {
inner_layer->setPrecision(nvinfer1::DataType::kHALF);
std::cout << "Set kHALF in " << inner_name << std::endl;
break;
}
if (layer_type == nvinfer1::LayerType::kMATRIX_MULTIPLY) {
layer->setPrecision(nvinfer1::DataType::kHALF);
std::cout << "Set kHALF in " << name << std::endl;
if (inner_layer_type == nvinfer1::LayerType::kMATRIX_MULTIPLY) {
inner_layer->setPrecision(nvinfer1::DataType::kHALF);
std::cout << "Set kHALF in " << inner_name << std::endl;
break;
}
}
Expand Down

0 comments on commit b1d7fcd

Please sign in to comment.