Skip to content

Commit 5677679

Browse files
committed
refactor(//core): Address compiler warnings for select
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 62e2500 commit 5677679

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

core/conversion/conversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void ConvertBlockToNetDef(
361361
eval_list->elements().size() == n->outputs().size(),
362362
"Size of evaluated results: " << eval_list->elements().size()
363363
<< " and node outputs size: " << n->outputs().size() << " must match.");
364-
for (int i = 0; i < eval_list->elements().size(); i++) {
364+
for (size_t i = 0; i < eval_list->elements().size(); i++) {
365365
auto eval_output = eval_list.get()->elements()[i];
366366
LOG_DEBUG(
367367
ctx->logger,

core/conversion/converters/impl/select.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ bool add_split(ConversionCtx* ctx, const torch::jit::Node* n, args& args, bool s
5858
}
5959

6060
auto split_output_ivalue = std::move(torch::jit::IValue(list));
61-
auto out = ctx->AssociateValueAndIValue(n->outputs()[0], split_output_ivalue);
61+
ctx->AssociateValueAndIValue(n->outputs()[0], split_output_ivalue);
62+
63+
return true;
6264
}
6365

6466
auto select_registrations TRTORCH_UNUSED =

core/conversion/evaluators/NodeEvaluatorRegistry.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class NodeEvaluatorRegistry {
5858
auto schema = n->maybeSchema();
5959
TRTORCH_CHECK(
6060
schema,
61-
"Evaluator for " << node_kind.toQualString()
62-
<< " only runs on certain schemas, but schema for target"
61+
"Evaluator for " << node_kind.toQualString() << " only runs on certain schemas, but schema for target"
6362
<< " node is not a supported schema variant of " << node_kind.toQualString());
6463
if (!FindInVec(eval_reg.options.valid_schemas, schema->operator_name())) {
6564
return nullptr;

tests/core/conversion/converters/test_select.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ TEST(Converters, ATenSplitSizesInScriptingConvertsCorrectly) {
228228
auto trt_in = at::clone(in);
229229
auto trt_results = trtorch::tests::util::RunGraphEngine(g, params, {trt_in});
230230

231-
for (int i = 0; i < jit_results.size(); i++) {
231+
for (size_t i = 0; i < jit_results.size(); i++) {
232232
auto trt = trt_results[i].reshape(jit_results[i].sizes());
233233
ASSERT_TRUE(trtorch::tests::util::almostEqual(jit_results[i], trt, 2e-6));
234234
}
@@ -256,7 +256,7 @@ TEST(Converters, ATenSplitSizesinTracingConvertsCorrectly) {
256256
auto trt_in = at::clone(in);
257257
auto trt_results = trtorch::tests::util::RunGraphEngine(g, params, {trt_in});
258258

259-
for (int i = 0; i < jit_results.size(); i++) {
259+
for (size_t i = 0; i < jit_results.size(); i++) {
260260
auto trt = trt_results[i].reshape(jit_results[i].sizes());
261261
ASSERT_TRUE(trtorch::tests::util::almostEqual(jit_results[i], trt, 2e-6));
262262
}
@@ -283,7 +283,7 @@ TEST(Converters, ATenSplitFixedConvertsCorrectly) {
283283
auto trt_in = at::clone(in);
284284
auto trt_results = trtorch::tests::util::RunGraphEngine(g, params, {trt_in});
285285

286-
for (int i = 0; i < jit_results.size(); i++) {
286+
for (size_t i = 0; i < jit_results.size(); i++) {
287287
auto trt = trt_results[i].reshape(jit_results[i].sizes());
288288
ASSERT_TRUE(trtorch::tests::util::almostEqual(jit_results[i], trt, 2e-6));
289289
}

tests/util/evaluate_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::vector<torch::jit::IValue> EvaluateGraph(const torch::jit::Block* b, std::v
3030
if (eval) {
3131
if (eval.value().isTuple()) {
3232
auto eval_list = eval.value().toTuple();
33-
for (int i = 0; i < eval_list->elements().size(); i++) {
33+
for (size_t i = 0; i < eval_list->elements().size(); i++) {
3434
auto eval_output = eval_list.get()->elements()[i];
3535
LOG_DEBUG(
3636
ctx->logger,

0 commit comments

Comments
 (0)