Skip to content

Commit 4903010

Browse files
authored
Merge pull request #314 from NVIDIA/clamp
Fix unused variable out warning
2 parents 2b50334 + 22ed944 commit 4903010

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

core/conversion/converters/impl/element_wise.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ auto element_wise_registrations TRTORCH_UNUSED =
176176
}
177177

178178
auto out = ctx->AssociateValueAndTensor(n->outputs()[0], clamp_layer_out);
179-
LOG_DEBUG("Clamp layer output tensor shape: " << clamp_layer_out->getDimensions());
179+
LOG_DEBUG("Clamp layer output tensor shape: " << out->getDimensions());
180180
return true;
181181
}})
182182
.pattern({"aten::sub.Tensor(Tensor self, Tensor other, Scalar alpha=1) -> "

tests/core/conversion/converters/test_element_wise.cpp

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -240,115 +240,115 @@ TEST(Converters, ATenRsubWithScalarConvertsCorrectly) {
240240

241241
TEST(Converters, ATenClampMinConvertsCorrectly) {
242242
const auto graph = R"IR(
243-
graph(%x.1 : Tensor):
244-
%2 : int = prim::Constant[value=-2]()
245-
%3 : None = prim::Constant()
246-
%4 : Tensor = aten::clamp(%x.1, %2, %3)
247-
return (%4))IR";
243+
graph(%x.1 : Tensor):
244+
%2 : int = prim::Constant[value=-2]()
245+
%3 : None = prim::Constant()
246+
%4 : Tensor = aten::clamp(%x.1, %2, %3)
247+
return (%4))IR";
248248
pointwise_test_helper(graph, true);
249249
}
250250

251251
TEST(Converters, ATenClampMaxConvertsCorrectly) {
252252
const auto graph = R"IR(
253-
graph(%x.1 : Tensor):
254-
%2 : int = prim::Constant[value=3]()
255-
%3 : None = prim::Constant()
256-
%4 : Tensor = aten::clamp(%x.1, %3, %2)
257-
return (%4))IR";
253+
graph(%x.1 : Tensor):
254+
%2 : int = prim::Constant[value=3]()
255+
%3 : None = prim::Constant()
256+
%4 : Tensor = aten::clamp(%x.1, %3, %2)
257+
return (%4))IR";
258258
pointwise_test_helper(graph, true);
259259
}
260260

261261
TEST(Converters, ATenClampMinMaxConvertsCorrectly) {
262262
const auto graph = R"IR(
263-
graph(%x.1 : Tensor):
264-
%2 : int = prim::Constant[value=3]()
265-
%3 : int = prim::Constant[value=-2]()
266-
%4 : Tensor = aten::clamp(%x.1, %3, %2)
267-
return (%4))IR";
263+
graph(%x.1 : Tensor):
264+
%2 : int = prim::Constant[value=3]()
265+
%3 : int = prim::Constant[value=-2]()
266+
%4 : Tensor = aten::clamp(%x.1, %3, %2)
267+
return (%4))IR";
268268
pointwise_test_helper(graph, true);
269269
}
270270

271271
TEST(Converters, ATenGreaterThanConvertsCorrectly) {
272272
const auto graph = R"IR(
273-
graph(%0 : Tensor, %1 : Tensor):
274-
%2 : Tensor = aten::gt(%0, %1)
275-
return (%2))IR";
273+
graph(%0 : Tensor, %1 : Tensor):
274+
%2 : Tensor = aten::gt(%0, %1)
275+
return (%2))IR";
276276
pointwise_test_helper(graph, false, false, {5, 5}, {5, 5});
277277
}
278278

279279
TEST(Converters, ATenGreaterThanScalarConvertsCorrectly) {
280280
const auto graph = R"IR(
281-
graph(%0 : Tensor):
282-
%scalar : float = prim::Constant[value=3]()
283-
%2 : Tensor = aten::gt(%0, %scalar)
284-
return (%2))IR";
281+
graph(%0 : Tensor):
282+
%scalar : float = prim::Constant[value=3]()
283+
%2 : Tensor = aten::gt(%0, %scalar)
284+
return (%2))IR";
285285
pointwise_test_helper(graph, true, false, {5, 5});
286286
}
287287

288288
TEST(Converters, ATenLessThanConvertsCorrectly) {
289289
const auto graph = R"IR(
290-
graph(%0 : Tensor, %1 : Tensor):
291-
%2 : Tensor = aten::lt(%0, %1)
292-
return (%2))IR";
290+
graph(%0 : Tensor, %1 : Tensor):
291+
%2 : Tensor = aten::lt(%0, %1)
292+
return (%2))IR";
293293
pointwise_test_helper(graph, false, false, {5, 5}, {5, 5});
294294
}
295295

296296
TEST(Converters, ATenLessThanScalarConvertsCorrectly) {
297297
const auto graph = R"IR(
298-
graph(%0 : Tensor):
299-
%scalar : float = prim::Constant[value=3]()
300-
%2 : Tensor = aten::lt(%0, %scalar)
301-
return (%2))IR";
298+
graph(%0 : Tensor):
299+
%scalar : float = prim::Constant[value=3]()
300+
%2 : Tensor = aten::lt(%0, %scalar)
301+
return (%2))IR";
302302
pointwise_test_helper(graph, true, false, {5, 5});
303303
}
304304

305305
TEST(Converters, ATenEqualConvertsCorrectly) {
306306
const auto graph = R"IR(
307-
graph(%0 : Tensor, %1 : Tensor):
308-
%2 : Tensor = aten::eq(%0, %1)
309-
return (%2))IR";
307+
graph(%0 : Tensor, %1 : Tensor):
308+
%2 : Tensor = aten::eq(%0, %1)
309+
return (%2))IR";
310310
pointwise_test_helper(graph, false, false, {5, 5}, {5, 5});
311311
}
312312

313313
TEST(Converters, ATenEqualScalarConvertsCorrectly) {
314314
const auto graph = R"IR(
315-
graph(%0 : Tensor):
316-
%scalar : float = prim::Constant[value=3]()
317-
%2 : Tensor = aten::eq(%0, %scalar)
318-
return (%2))IR";
315+
graph(%0 : Tensor):
316+
%scalar : float = prim::Constant[value=3]()
317+
%2 : Tensor = aten::eq(%0, %scalar)
318+
return (%2))IR";
319319
pointwise_test_helper(graph, true, false, {5, 5});
320320
}
321321

322322
TEST(Converters, ATenGEConvertsCorrectly) {
323323
const auto graph = R"IR(
324-
graph(%0 : Tensor, %1 : Tensor):
325-
%2 : Tensor = aten::ge(%0, %1)
326-
return (%2))IR";
324+
graph(%0 : Tensor, %1 : Tensor):
325+
%2 : Tensor = aten::ge(%0, %1)
326+
return (%2))IR";
327327
pointwise_test_helper(graph, false, false, {5, 5}, {5, 5});
328328
}
329329

330330
TEST(Converters, ATenGEScalarConvertsCorrectly) {
331331
const auto graph = R"IR(
332-
graph(%0 : Tensor):
333-
%scalar : float = prim::Constant[value=3]()
334-
%2 : Tensor = aten::ge(%0, %scalar)
335-
return (%2))IR";
332+
graph(%0 : Tensor):
333+
%scalar : float = prim::Constant[value=3]()
334+
%2 : Tensor = aten::ge(%0, %scalar)
335+
return (%2))IR";
336336
pointwise_test_helper(graph, true, false, {5, 5});
337337
}
338338

339339
TEST(Converters, ATenLEConvertsCorrectly) {
340340
const auto graph = R"IR(
341-
graph(%0 : Tensor, %1 : Tensor):
342-
%2 : Tensor = aten::le(%0, %1)
343-
return (%2))IR";
341+
graph(%0 : Tensor, %1 : Tensor):
342+
%2 : Tensor = aten::le(%0, %1)
343+
return (%2))IR";
344344
pointwise_test_helper(graph, false, false, {5, 5}, {5, 5});
345345
}
346346

347347
TEST(Converters, ATenLEScalarConvertsCorrectly) {
348348
const auto graph = R"IR(
349-
graph(%0 : Tensor):
350-
%scalar : float = prim::Constant[value=3]()
351-
%2 : Tensor = aten::le(%0, %scalar)
352-
return (%2))IR";
349+
graph(%0 : Tensor):
350+
%scalar : float = prim::Constant[value=3]()
351+
%2 : Tensor = aten::le(%0, %scalar)
352+
return (%2))IR";
353353
pointwise_test_helper(graph, true, false, {5, 5});
354354
}

0 commit comments

Comments
 (0)