Skip to content

Commit 2e80323

Browse files
committed
Use { and } around conditionally-executed single line statements
1 parent a96013f commit 2e80323

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/imatrix/imatrix.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
432432
e.counts.resize(n_as, e.counts[0]);
433433
}
434434
if (e.values.empty()) {
435-
if (activation_statistics()) e.activations.resize(src1->ne[0]*n_as, 0);
435+
if (activation_statistics()) { e.activations.resize(src1->ne[0]*n_as, 0); }
436436
e.values.resize(src1->ne[0]*n_as, 0);
437437
e.counts.resize(n_as, 0);
438438
}
@@ -464,7 +464,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
464464
e.counts[ex]++;
465465

466466
for (int64_t j = 0; j < src1->ne[0]; ++j) {
467-
if (activation_statistics()) e.activations[e_start + j] += x[j];
467+
if (activation_statistics()) { e.activations[e_start + j] += x[j]; }
468468
e.values[e_start + j] += x[j] * x[j];
469469
if (!std::isfinite((float)e.values[e_start + j])) {
470470
LOG_ERR("%f detected in %s\n", (float)e.values[e_start + j], wname.c_str());
@@ -504,7 +504,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
504504
}
505505
}
506506
if (e.values.empty()) {
507-
if (activation_statistics()) e.activations.resize(src1->ne[0] * n_mat, 0);
507+
if (activation_statistics()) { e.activations.resize(src1->ne[0] * n_mat, 0); }
508508
e.values.resize(src1->ne[0] * n_mat, 0);
509509
e.counts.resize(1, 0);
510510
}
@@ -523,7 +523,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
523523
for (int64_t row = 0; row < src1->ne[1]; ++row) {
524524
const float * x = (const float *) (data + row * src1->nb[1] + i2 * src1->nb[2] + i3 * src1->nb[3]);
525525
for (int64_t j = 0; j < src1->ne[0]; ++j) {
526-
if (activation_statistics()) e.activations[mat_start + j] += x[j];
526+
if (activation_statistics()) { e.activations[mat_start + j] += x[j]; }
527527
e.values[mat_start + j] += x[j] * x[j];
528528
if (!std::isfinite((float)e.values[j])) {
529529
LOG_ERR("%f detected in %s\n", (float)e.values[j], wname.c_str());

0 commit comments

Comments
 (0)