Skip to content

Commit 798f1ec

Browse files
committed
style: format the code
1 parent d77866a commit 798f1ec

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

lib/kernels/test/src/test_concat_kernel.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ TEST_SUITE(FF_TEST_SUITE) {
2929
allocator.allocate_tensor(output_shape);
3030

3131
Kernels::Concat::forward_kernel(managed_stream.raw_stream(),
32-
output_accessor, input_accessors,
32+
output_accessor,
33+
input_accessors,
3334
concat_axis);
3435

3536
std::vector<float> host_output_data =
@@ -49,7 +50,8 @@ TEST_SUITE(FF_TEST_SUITE) {
4950
});
5051
Kernels::Concat::backward_kernel(managed_stream.raw_stream(),
5152
output_grad_accessor,
52-
input_grad_accessors, concat_axis);
53+
input_grad_accessors,
54+
concat_axis);
5355
}
5456
}
5557
}

lib/kernels/test/src/test_dropout.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ TEST_SUITE(FF_TEST_SUITE) {
2424
DropoutPerDeviceState state = Kernels::Dropout::init_kernel(
2525
managed_handle.raw_handle(), dropout_rate, seed, shape, allocator);
2626

27-
auto get_zero_count = [](const std::vector<float>& data) {
28-
return std::count_if(data.begin(), data.end(), [](float x) { return x == 0.0f; });
27+
auto get_zero_count = [](std::vector<float> const &data) {
28+
return std::count_if(
29+
data.begin(), data.end(), [](float x) { return x == 0.0f; });
2930
};
3031

3132
SUBCASE("forward_kernel") {

lib/kernels/test/src/test_utils.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include "kernels/managed_ff_stream.h"
77
#include "kernels/managed_per_device_ff_handle.h"
88
#include <doctest/doctest.h>
9-
#include <vector>
10-
#include <string>
11-
#include <sstream>
129
#include <random>
10+
#include <sstream>
11+
#include <string>
12+
#include <vector>
1313

1414
using namespace FlexFlow;
1515

@@ -53,28 +53,28 @@ bool contains_non_zero(std::vector<T> &data) {
5353
}
5454

5555
template <typename T, typename Func>
56-
std::vector<T> repeat(std::size_t n, Func&& func) {
57-
std::vector<T> result;
58-
// result.reserve(n); // Sometimes we don't have default constructor for T
59-
for (std::size_t i = 0; i < n; ++i) {
60-
result.push_back(func());
61-
}
62-
return result;
56+
std::vector<T> repeat(std::size_t n, Func &&func) {
57+
std::vector<T> result;
58+
// result.reserve(n); // Sometimes we don't have default constructor for T
59+
for (std::size_t i = 0; i < n; ++i) {
60+
result.push_back(func());
61+
}
62+
return result;
6363
}
6464

6565
// Specialize doctest's StringMaker for std::vector<float>
6666
template <>
6767
struct doctest::StringMaker<std::vector<float>> {
68-
static doctest::String convert(const std::vector<float>& vec) {
69-
std::ostringstream oss;
70-
for (size_t i = 0; i < vec.size(); ++i) {
71-
oss << vec[i];
72-
if (i != vec.size() - 1) {
73-
oss << ", ";
74-
}
75-
}
76-
return doctest::String(("[" + oss.str() + "]").c_str());
68+
static doctest::String convert(std::vector<float> const &vec) {
69+
std::ostringstream oss;
70+
for (size_t i = 0; i < vec.size(); ++i) {
71+
oss << vec[i];
72+
if (i != vec.size() - 1) {
73+
oss << ", ";
74+
}
7775
}
76+
return doctest::String(("[" + oss.str() + "]").c_str());
77+
}
7878
};
7979

8080
#endif

0 commit comments

Comments
 (0)