Skip to content

Commit a1d1686

Browse files
committed
refactor(aten::leaky_relu): Apply linting
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 6bbcecb commit a1d1686

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

core/conversion/converters/impl/activation.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,20 @@ auto acthardtanh TRTORCH_UNUSED =
125125
LOG_DEBUG("Output shape: " << out_tensor->getDimensions());
126126
return true;
127127
}})
128-
.pattern(
129-
{"aten::leaky_relu(Tensor self, Scalar negative_slope=0.01) -> (Tensor)",
130-
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
131-
auto self = args[0].ITensorOrFreeze(ctx);
132-
auto negative_slopeScalar = args[1].unwrapToScalar().to<float>();
128+
.pattern({"aten::leaky_relu(Tensor self, Scalar negative_slope=0.01) -> (Tensor)",
129+
[](ConversionCtx* ctx, const torch::jit::Node* n, args& args) -> bool {
130+
auto self = args[0].ITensorOrFreeze(ctx);
131+
auto negative_slopeScalar = args[1].unwrapToScalar().to<float>();
133132

134-
auto new_layer = ctx->net->addActivation(*self, nvinfer1::ActivationType::kLEAKY_RELU);
135-
new_layer->setAlpha(negative_slopeScalar);
136-
137-
new_layer->setName(util::node_info(n).c_str());
138-
auto out_tensor = new_layer->getOutput(0);
139-
out_tensor = ctx->AssociateValueAndTensor(n->outputs()[0], out_tensor);
140-
LOG_DEBUG("Output shape: " << out_tensor->getDimensions());
141-
return true;
142-
}});
133+
auto new_layer = ctx->net->addActivation(*self, nvinfer1::ActivationType::kLEAKY_RELU);
134+
new_layer->setAlpha(negative_slopeScalar);
143135

136+
new_layer->setName(util::node_info(n).c_str());
137+
auto out_tensor = new_layer->getOutput(0);
138+
out_tensor = ctx->AssociateValueAndTensor(n->outputs()[0], out_tensor);
139+
LOG_DEBUG("Output shape: " << out_tensor->getDimensions());
140+
return true;
141+
}});
144142

145143
} // namespace
146144
} // namespace impl

0 commit comments

Comments
 (0)