Skip to content

Commit 464fae5

Browse files
committed
Fix variable naming to reflect types
1 parent 7456d31 commit 464fae5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

core/conversion/converters/converter_util.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ nvinfer1::ILayer* add_absolute_value(
161161
const torch::jit::Node* n,
162162
nvinfer1::ITensor* self,
163163
const std::string& name) {
164-
nvinfer1::ILayer* absolute_value;
164+
nvinfer1::ILayer* absolute_value_layer;
165165

166166
// Check if TRT Unary ops support the input type
167167
bool unary_supported_input = (self->getType() == nvinfer1::DataType::kFLOAT) ||
168168
(self->getType() == nvinfer1::DataType::kHALF) || (self->getType() == nvinfer1::DataType::kINT8);
169169
if (unary_supported_input) {
170-
absolute_value = ctx->net->addUnary(*self, nvinfer1::UnaryOperation::kABS);
171-
TORCHTRT_CHECK(absolute_value, "Unable to create abs layer from node: " << *n);
172-
absolute_value->setName(name.c_str());
170+
absolute_value_layer = ctx->net->addUnary(*self, nvinfer1::UnaryOperation::kABS);
171+
TORCHTRT_CHECK(absolute_value_layer, "Unable to create abs layer from node: " << *n);
172+
absolute_value_layer->setName(name.c_str());
173173
} else {
174174
LOG_GRAPH(
175175
"Tensor is of unsupported type "
@@ -180,11 +180,12 @@ nvinfer1::ILayer* add_absolute_value(
180180
auto neg_layer = add_elementwise(
181181
ctx, nvinfer1::ElementWiseOperation::kPROD, self, neg_one_const, util::node_info(n) + std::string("_Negation"));
182182
TORCHTRT_CHECK(neg_layer, "Unable to create prod layer from node: " << *n);
183-
absolute_value = add_elementwise(ctx, nvinfer1::ElementWiseOperation::kMAX, self, neg_layer->getOutput(0), name);
184-
TORCHTRT_CHECK(absolute_value, "Unable to create max layer from node: " << *n);
183+
absolute_value_layer =
184+
add_elementwise(ctx, nvinfer1::ElementWiseOperation::kMAX, self, neg_layer->getOutput(0), name);
185+
TORCHTRT_CHECK(absolute_value_layer, "Unable to create max layer from node: " << *n);
185186
}
186187

187-
return absolute_value;
188+
return absolute_value_layer;
188189
}
189190

190191
nvinfer1::ITensor* applyIdentityOp(ConversionCtx* ctx, nvinfer1::ITensor* tensor, const std::string& tensor_name) {

0 commit comments

Comments
 (0)