Skip to content

Commit

Permalink
Fix format line and format
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeRoggenbuck committed Oct 17, 2023
1 parent fe700f8 commit e944bd3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ We use [clang-format](https://www.kernel.org/doc/html/latest/process/clang-forma
Before you push your code, you can run the following that finds all source code files, and then formats them all in place.

```
find . -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.c" -o -iname "*.h" | xargs -I {} clang-format -i -style='{IndentWidth: 4, ReferenceAlignment: Left}' {}
find . -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.c" -o -iname "*.h" -o -iname "*.tpp" | xargs -I {} clang-format {}
```

You can also add this to your editors formatting system or some precommit step.
8 changes: 4 additions & 4 deletions core/include/jml/model.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace jml {

template<typename Iter>
void Model::add_testing_data (Iter inb, Iter ine, Iter otb, Iter ote) {
testing_data_inputs .insert(std::end(testing_data_inputs), inb, ine);
template <typename Iter>
void Model::add_testing_data(Iter inb, Iter ine, Iter otb, Iter ote) {
testing_data_inputs.insert(std::end(testing_data_inputs), inb, ine);
testing_data_outputs.insert(std::end(testing_data_outputs), otb, ote);
}

}
} // namespace jml
6 changes: 4 additions & 2 deletions tests/core/math/test_activation_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
TEST_CASE("FastSigmoid function", "[activation_function]") {
jml::FastSigmoid act;

// FIXME: I don't know what mathematically significant values to check so here's some random ones
// FIXME: I don't know what mathematically significant values to check so
// here's some random ones
// FIXME: FastSigmoid impl appears to have forgotten the constant offset
REQUIRE_THAT(act.f(-1), Catch::Matchers::WithinRel(-0.25, 0.00001));
REQUIRE_THAT(act.f(0), Catch::Matchers::WithinRel(0, 0.00001));
Expand Down Expand Up @@ -49,7 +50,8 @@ TEST_CASE("LeakyReLU activation function", "[activation_function]") {
REQUIRE(act.df(1) == 1);
}

TEST_CASE("LeakyReLU activation function with custom leak", "[activation_function]") {
TEST_CASE("LeakyReLU activation function with custom leak",
"[activation_function]") {
jml::LeakyReLU act(0.0001);

// TODO: is it necessary to check function values?
Expand Down
5 changes: 2 additions & 3 deletions tests/core/math/test_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SCENARIO("Matrix entries can be set and get", "[matrix]") {
m.set_entry(0, 2, 5);
m.set_entry(1, 2, 6);
}());

THEN("the stored values are correct") {
REQUIRE(m.get_entry(0, 0) == 1);
REQUIRE(m.get_entry(1, 0) == 2);
Expand All @@ -44,8 +44,7 @@ SCENARIO("Matrix entries can be set and get", "[matrix]") {
}
}

SCENARIO("Matrix is correctly multiplied with vector",
"[matrix][vector]") {
SCENARIO("Matrix is correctly multiplied with vector", "[matrix][vector]") {
GIVEN("a matrix and vector with some values") {
jml::Matrix m(2, 3);
jml::Vector V(3);
Expand Down
2 changes: 1 addition & 1 deletion tests/core/math/test_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SCENARIO("Vector is added to another vector") {
SCENARIO("Activation function is applied to a vector") {
GIVEN("a vector and an activation function") {
jml::Vector v(3);
jml::ReLU act; // Use ReLU for simplicity
jml::ReLU act; // Use ReLU for simplicity

v.set_entry(0, -10);
v.set_entry(1, 0);
Expand Down

0 comments on commit e944bd3

Please sign in to comment.