Skip to content

Commit 2b0e082

Browse files
author
Tristan Konolige
authored
[FIX] Add braces to if-else statements (#11493)
Some if-else statements were missing braces. They have been added as per our style guide.
1 parent 2389f1f commit 2b0e082

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

include/tvm/topi/nn/softmax.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ inline Tensor softmax(const Tensor& x, int axis = -1, std::string name = "tensor
6767
Array<PrimExpr> eval_range;
6868
int arg_counter = 0;
6969
for (size_t i = 0; i < ndim; ++i) {
70-
if (static_cast<int>(i) == axis)
70+
if (static_cast<int>(i) == axis) {
7171
eval_range.push_back(reduce_index);
72-
else
72+
} else {
7373
eval_range.push_back(indices[arg_counter++]);
74+
}
7475
}
7576
return eval_range;
7677
};

include/tvm/topi/transform.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,10 +1467,11 @@ inline Tensor tensordot(const Tensor& A, const tvm::te::Tensor& B, int axes = 2,
14671467
for (; it != input_indices.end(); ++it) B_indices.push_back(*it);
14681468

14691469
// Some passes don't like reductions with empty axis, so avoid it here
1470-
if (iter_vars.empty())
1470+
if (iter_vars.empty()) {
14711471
return A(A_indices) * B(B_indices);
1472-
else
1472+
} else {
14731473
return sum(A(A_indices) * B(B_indices), iter_vars);
1474+
}
14741475
};
14751476

14761477
return compute(output_shape, func, name, tag);
@@ -1513,19 +1514,21 @@ inline Tensor tensordot(const Tensor& A, const tvm::te::Tensor& B, Array<PrimExp
15131514
Array<PrimExpr> A_indices;
15141515
for (unsigned i = 0; i < A->shape.size(); ++i) {
15151516
auto axes_pos = std::find(A_axes_val.begin(), A_axes_val.end(), i);
1516-
if (axes_pos == A_axes_val.end())
1517+
if (axes_pos == A_axes_val.end()) {
15171518
A_indices.push_back(input_indices[idx_input++]);
1518-
else
1519+
} else {
15191520
A_indices.push_back(iter_vars[axes_pos - A_axes_val.begin()]);
1521+
}
15201522
}
15211523

15221524
Array<PrimExpr> B_indices;
15231525
for (unsigned i = 0; i < B->shape.size(); ++i) {
15241526
auto axes_pos = std::find(B_axes_val.begin(), B_axes_val.end(), i);
1525-
if (axes_pos == B_axes_val.end())
1527+
if (axes_pos == B_axes_val.end()) {
15261528
B_indices.push_back(input_indices[idx_input++]);
1527-
else
1529+
} else {
15281530
B_indices.push_back(iter_vars[axes_pos - B_axes_val.begin()]);
1531+
}
15291532
}
15301533
return sum(A(A_indices) * B(B_indices), iter_vars);
15311534
};

src/meta_schedule/utils.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ class PyLogMessage {
8383
if (this->logging_func.defined()) {
8484
logging_func(static_cast<int>(logging_level), stream_.str());
8585
} else {
86-
if (logging_level == Level::INFO)
86+
if (logging_level == Level::INFO) {
8787
LOG(INFO) << stream_.str();
88-
else if (logging_level == Level::WARNING)
88+
} else if (logging_level == Level::WARNING) {
8989
LOG(WARNING) << stream_.str();
90-
else if (logging_level == Level::ERROR)
90+
} else if (logging_level == Level::ERROR) {
9191
LOG(ERROR) << stream_.str();
92-
else if (logging_level == Level::DEBUG)
92+
} else if (logging_level == Level::DEBUG) {
9393
DLOG(INFO) << stream_.str();
94-
else
94+
} else {
9595
LOG(FATAL) << stream_.str();
96+
}
9697
}
9798
}
9899
std::ostringstream& stream() { return stream_; }

0 commit comments

Comments
 (0)