Skip to content

Commit 9ded69d

Browse files
committed
fix confs fix namespace
1 parent 207117b commit 9ded69d

File tree

4 files changed

+12
-33
lines changed

4 files changed

+12
-33
lines changed

include/layers/ReduceLayer.hpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
#include "layers/Layer.hpp"
55
#include "layers/Tensor.hpp"
66

7-
namespace itlab_2023 {
7+
namespace it_lab_ai {
88

99
class ReduceLayer : public Layer {
1010
public:
11-
enum class Operation {
12-
kSum,
13-
kMean,
14-
kMult,
15-
kMax,
16-
kMin
17-
};
11+
enum class Operation { kSum, kMean, kMult, kMax, kMin };
1812

1913
ReduceLayer(Operation op, int64_t keepdims = 0);
2014
explicit ReduceLayer(int64_t keepdims = 0)
@@ -28,7 +22,7 @@ class ReduceLayer : public Layer {
2822
Operation op_;
2923
int64_t keepdims_;
3024
static void normalize_axes(const Shape& input_shape,
31-
std::vector<int64_t>& axes);
25+
std::vector<int64_t>& axes);
3226
Shape calculate_output_shape(const Shape& input_shape,
3327
const std::vector<int64_t>& axes) const;
3428

@@ -37,4 +31,4 @@ class ReduceLayer : public Layer {
3731
const std::vector<int64_t>& axes, Tensor& output) const;
3832
};
3933

40-
} // namespace itlab_2023
34+
} // namespace it_lab_ai

include/layers/Shape.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ class Shape {
4949

5050
bool operator!=(const Shape& other) const { return !(*this == other); }
5151
friend std::ostream& operator<<(std::ostream& os, const Shape& shape);
52-
bool operator==(const Shape& other) const noexcept {
53-
if (dims_.size() != other.dims_.size()) {
54-
return false;
55-
}
56-
return std::equal(dims_.begin(), dims_.end(), other.dims_.begin());
57-
}
58-
59-
bool operator!=(const Shape& other) const noexcept {
60-
return !(*this == other);
61-
}
6252

6353
private:
6454
std::vector<size_t> dims_;

src/layers/ReduceLayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <limits>
55
#include <numeric>
66

7-
namespace itlab_2023 {
7+
namespace it_lab_ai {
88

99
ReduceLayer::ReduceLayer(Operation op, int64_t keepdims)
1010
: op_(op), keepdims_(keepdims) {}
@@ -210,4 +210,4 @@ void ReduceLayer::run(const Tensor& input, const Tensor& axes, Tensor& output) {
210210
}
211211
}
212212

213-
} // namespace itlab_2023
213+
} // namespace it_lab_ai

test/single_layer/test_reducelayer.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
#include "layers/ReduceLayer.hpp"
44
#include "layers/Tensor.hpp"
55

6-
namespace itlab_2023 {
6+
namespace it_lab_ai {
77

8-
TEST(ReduceLayer, DefaultConstructor) {
9-
ASSERT_NO_THROW(ReduceLayer layer);
10-
}
8+
TEST(ReduceLayer, DefaultConstructor) { ASSERT_NO_THROW(ReduceLayer layer); }
119

1210
TEST(ReduceLayer, SumAllAxesKeepDims) {
1311
ReduceLayer layer(1);
@@ -146,12 +144,9 @@ TEST(ReduceLayer, Resnet) {
146144

147145
layer.run(input, axes, output);
148146

149-
EXPECT_EQ(output.get_shape(),
150-
Shape({1, 1, 3, 3, 3}));
151-
EXPECT_FLOAT_EQ(output.get<float>({0, 0, 0, 0, 0}),
152-
1.0f + 28.0f);
153-
EXPECT_FLOAT_EQ(output.get<float>({0, 0, 2, 2, 2}),
154-
27.0f + 54.0f);
147+
EXPECT_EQ(output.get_shape(), Shape({1, 1, 3, 3, 3}));
148+
EXPECT_FLOAT_EQ(output.get<float>({0, 0, 0, 0, 0}), 1.0f + 28.0f);
149+
EXPECT_FLOAT_EQ(output.get<float>({0, 0, 2, 2, 2}), 27.0f + 54.0f);
155150
}
156151

157152
TEST(ReduceLayer, NegativeAxisBasic) {
@@ -277,4 +272,4 @@ TEST(ReduceLayer, ResnetReduceMean) {
277272
9.0f);
278273
}
279274

280-
} // namespace itlab_2023
275+
} // namespace it_lab_ai

0 commit comments

Comments
 (0)