Skip to content

Commit 04a2f6f

Browse files
authored
Remove build.cpp file inclusion (#227)
- Remove workaround with including `build.cpp` - Do not initialise unordered_map in header file (ODR violation)
1 parent ffd9bfa commit 04a2f6f

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: DoozyX/clang-format-lint-action@v0.15
1616
with:
17-
source: '.'
17+
source: './app ./include ./src ./test'
1818
build-linux:
1919
strategy:
2020
matrix:

app/Graph/acc_check.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <sstream>
66
#include <unordered_map>
77

8-
#include "build.cpp"
98
#include "build.hpp"
109

1110
namespace fs = std::filesystem;

app/Graph/build.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55
using namespace it_lab_ai;
66

7+
bool LayerFactory::onednn_ = false;
8+
9+
std::unordered_map<std::string, std::string> model_paths = {
10+
{"alexnet_mnist", MODEL_PATH_H5},
11+
{"googlenet", MODEL_PATH_GOOGLENET_ONNX},
12+
{"resnet", MODEL_PATH_RESNET_ONNX},
13+
{"densenet", MODEL_PATH_DENSENET_ONNX},
14+
{"yolo", MODEL_PATH_YOLO11NET_ONNX}};
15+
716
void build_graph_linear(it_lab_ai::Graph& graph, it_lab_ai::Tensor& input,
817
it_lab_ai::Tensor& output, bool comments) {
918
if (comments) {

app/Graph/build.hpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@
3333
#include "layers/TransposeLayer.hpp"
3434
#include "layers_oneDNN/EWLayer.hpp"
3535

36-
std::unordered_map<std::string, std::string> model_paths = {
37-
{"alexnet_mnist", MODEL_PATH_H5},
38-
{"googlenet", MODEL_PATH_GOOGLENET_ONNX},
39-
{"resnet", MODEL_PATH_RESNET_ONNX},
40-
{"densenet", MODEL_PATH_DENSENET_ONNX},
41-
{"yolo", MODEL_PATH_YOLO11NET_ONNX}};
36+
extern std::unordered_map<std::string, std::string> model_paths;
4237

4338
struct ParseResult {
4439
std::vector<std::unique_ptr<it_lab_ai::Layer>> layers;
@@ -93,6 +88,4 @@ class LayerFactory {
9388
}
9489
};
9590

96-
bool LayerFactory::onednn_ = false;
97-
9891
} // namespace it_lab_ai

app/Graph/graph_build.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <numeric>
33
#include <unordered_map>
44

5-
#include "build.cpp"
65
#include "build.hpp"
76

87
namespace fs = std::filesystem;

0 commit comments

Comments
 (0)