Skip to content

Commit 499ed46

Browse files
committed
fix
1 parent 1b844c2 commit 499ed46

6 files changed

Lines changed: 20 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ endforeach()
5151
add_subdirectory(app)
5252
add_subdirectory(include)
5353
add_subdirectory(src)
54+
add_subdirectory(src/layers_oneDNN)
5455
add_subdirectory(test)

app/Graph/acc_check.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
7272
for (int j = 0; j < 28; ++j) {
7373
size_t a = ind;
7474
for (size_t n = 0; n < name; n++) a += counts[n] + 1;
75-
res[(a)*28 * 28 + i * 28 + j] = channels[0].at<uchar>(j, i);
75+
res[(a) * 28 * 28 + i * 28 + j] = channels[0].at<uchar>(j, i);
7676
}
7777
}
7878
}

app/Graph/build.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void build_graph(it_lab_ai::Tensor& input, it_lab_ai::Tensor& output,
377377
}
378378

379379
ParseResult parse_json_model(const std::string& json_path, bool comments,
380-
bool parallel, bool use_onednn) {
380+
bool parallel, bool onednn) {
381381
ParseResult result;
382382

383383
auto& layers = result.layers;
@@ -495,15 +495,15 @@ ParseResult parse_json_model(const std::string& json_path, bool comments,
495495
} else if (layer_type.find("Relu") != std::string::npos ||
496496
layer_type.find("relu") != std::string::npos) {
497497
std::shared_ptr<it_lab_ai::Layer> ew_layer;
498-
if (use_onednn) {
498+
if (onednn) {
499499
ew_layer = std::make_shared<it_lab_ai::EWLayer_oneDNN>("relu");
500500
} else {
501501
ew_layer = std::make_shared<it_lab_ai::EWLayer>("relu");
502502
}
503503
layer = ew_layer;
504504
} else if (layer_type.find("Sigmoid") != std::string::npos) {
505505
std::shared_ptr<it_lab_ai::Layer> ew_layer;
506-
if (use_onednn) {
506+
if (onednn) {
507507
ew_layer = std::make_shared<it_lab_ai::EWLayer_oneDNN>("sigmoid");
508508
} else {
509509
ew_layer = std::make_shared<it_lab_ai::EWLayer>("sigmoid");
@@ -733,7 +733,7 @@ ParseResult parse_json_model(const std::string& json_path, bool comments,
733733
if (layer_type == "Mul") {
734734
ew_operation = "linear";
735735
std::shared_ptr<it_lab_ai::Layer> ew_layer;
736-
if (use_onednn) {
736+
if (onednn) {
737737
ew_layer = std::make_shared<it_lab_ai::EWLayer_oneDNN>(
738738
ew_operation, value, 0.0F);
739739
} else {
@@ -744,7 +744,7 @@ ParseResult parse_json_model(const std::string& json_path, bool comments,
744744
} else if (layer_type == "Add") {
745745
ew_operation = "linear";
746746
std::shared_ptr<it_lab_ai::Layer> ew_layer;
747-
if (use_onednn &&
747+
if (onednn &&
748748
it_lab_ai::EWLayer_oneDNN::is_function_supported("linear")) {
749749
ew_layer = std::make_shared<it_lab_ai::EWLayer_oneDNN>(
750750
ew_operation, 1.0F, value);
@@ -756,7 +756,7 @@ ParseResult parse_json_model(const std::string& json_path, bool comments,
756756
} else if (layer_type == "Sub") {
757757
ew_operation = "linear";
758758
std::shared_ptr<it_lab_ai::Layer> ew_layer;
759-
if (use_onednn &&
759+
if (onednn &&
760760
it_lab_ai::EWLayer_oneDNN::is_function_supported("linear")) {
761761
ew_layer = std::make_shared<it_lab_ai::EWLayer_oneDNN>(
762762
ew_operation, 1.0F, -value);

app/Graph/build.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::unordered_map<int, std::string> load_class_names(
6666
const std::string& filename);
6767

6868
ParseResult parse_json_model(const std::string& json_path, bool comments,
69-
bool parallel, bool use_onednn);
69+
bool parallel, bool onednn);
7070

7171
std::vector<int> get_input_shape_from_json(const std::string& json_path);
7272
std::vector<float> process_model_output(const std::vector<float>& output,

test/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ add_executable(run_test ${TEST_SRC_FILES})
44
if (NOT WIN32)
55
target_link_libraries(run_test PUBLIC OpenMP::OpenMP_CXX)
66
endif()
7-
target_link_libraries(run_test PUBLIC perf_lib layers_lib)
7+
target_link_libraries(run_test PUBLIC perf_lib layers_lib layers_oneDNN_lib)
88
target_link_libraries(run_test PUBLIC gtest)
99
target_link_libraries(run_test PUBLIC ReadLib)
1010
target_link_libraries(run_test PUBLIC reader_lib)
@@ -26,6 +26,14 @@ if (WIN32)
2626
"${CMAKE_BINARY_DIR}/bin/")
2727
endif()
2828

29+
if (WIN32)
30+
add_custom_command(TARGET run_test POST_BUILD
31+
COMMAND ${CMAKE_COMMAND} -E copy
32+
$<TARGET_FILE:dnnl>
33+
$<TARGET_FILE_DIR:run_test>
34+
)
35+
endif()
36+
2937
add_test(UnitTests ${CMAKE_BINARY_DIR}/bin/run_test)
3038

3139
file(DOWNLOAD

test/single_layer/test_ewlayer_onednn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ TEST(ewlayer_onednn, multidim_tensor_relu) {
147147
}
148148

149149
TEST(ewlayer_onednn, unsupported_function_throws) {
150-
EXPECT_THROW({ EWLayer_oneDNN layer("unsupported_function"); },
151-
std::invalid_argument);
150+
EXPECT_THROW(
151+
{ EWLayer_oneDNN layer("unsupported_function"); },std::invalid_argument);
152152
}
153153

154154
TEST(ewlayer_onednn, compare_with_naive_relu) {

0 commit comments

Comments
 (0)