Skip to content

Commit b26c8b7

Browse files
committed
Fix format error in applications_performance test
1 parent 0ad9a5a commit b26c8b7

File tree

1 file changed

+15
-112
lines changed

1 file changed

+15
-112
lines changed

test/applications_performance.cpp

Lines changed: 15 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -51,139 +51,42 @@ int main()
5151

5252
bool error = false;
5353

54-
for (const auto& model_path : model_paths)
55-
{
54+
for (const auto& model_path : model_paths) {
5655
std::cout << "----" << std::endl;
5756
std::cout << model_path << std::endl;
58-
#ifdef NDEBUG
59-
try
60-
{
57+
#ifdef NDEBUG
58+
try {
6159
const auto model = fdeep::load_model(model_path, true);
6260
const std::size_t warm_up_runs = 3;
6361
const std::size_t test_runs = 5;
64-
for (std::size_t i = 0; i < warm_up_runs; ++i)
65-
{
62+
for (std::size_t i = 0; i < warm_up_runs; ++i) {
6663
const double duration = model.test_speed();
6764
std::cout << "Forward pass took "
68-
<< duration << " s." << std::endl;
65+
<< duration << " s." << std::endl;
6966
}
7067
double duration_sum = 0;
7168
std::cout << "Starting performance measurements." << std::endl;
72-
for (std::size_t i = 0; i < test_runs; ++i)
73-
{
69+
for (std::size_t i = 0; i < test_runs; ++i) {
7470
const double duration = model.test_speed();
7571
duration_sum += duration;
7672
std::cout << "Forward pass took "
77-
<< duration << " s." << std::endl;
73+
<< duration << " s." << std::endl;
7874
}
79-
const double duration_avg =
80-
duration_sum / static_cast<double>(test_runs);
75+
const double duration_avg = duration_sum / static_cast<double>(test_runs);
8176
std::cout << "Forward pass took "
82-
<< duration_avg << " s on average." << std::endl;
83-
}
84-
catch (const std::exception& e)
85-
{
86-
std::cerr << "ERROR: " << e.what() << std::endl;
87-
error = true;
88-
}
89-
#else
90-
const auto model = fdeep::load_model(model_path, true);
91-
#endif
92-
}
93-
94-
if (error)
95-
{
96-
std::cout << "There were errors." << std::endl;
97-
return 1;
98-
}
99-
std::cout << "All imports and test OK." << std::endl;
100-
}std::vector<std::string> model_paths = {
101-
// "convnextbase.json",
102-
// "convnextlarge.json",
103-
// "convnextsmall.json",
104-
// "convnexttiny.json",
105-
// "convnextxlarge.json",
106-
"densenet121.json",
107-
"densenet169.json",
108-
"densenet201.json",
109-
"efficientnetb0.json",
110-
"efficientnetb1.json",
111-
"efficientnetb2.json",
112-
"efficientnetb3.json",
113-
"efficientnetb4.json",
114-
"efficientnetb5.json",
115-
"efficientnetb6.json",
116-
"efficientnetb7.json",
117-
"efficientnetv2b0.json",
118-
"efficientnetv2b1.json",
119-
"efficientnetv2b2.json",
120-
"efficientnetv2b3.json",
121-
"efficientnetv2l.json",
122-
"efficientnetv2m.json",
123-
"efficientnetv2s.json",
124-
// "inceptionresnetv2.json",
125-
"inceptionv3.json",
126-
"mobilenet.json",
127-
"mobilenetv2.json",
128-
"nasnetlarge.json",
129-
"nasnetmobile.json",
130-
"resnet101.json",
131-
"resnet101v2.json",
132-
"resnet152.json",
133-
"resnet152v2.json",
134-
"resnet50.json",
135-
"resnet50v2.json",
136-
"vgg16.json",
137-
"vgg19.json",
138-
"xception.json"
139-
};
140-
141-
bool error = false;
142-
143-
for (const auto& model_path : model_paths)
144-
{
145-
std::cout << "----" << std::endl;
146-
std::cout << model_path << std::endl;
147-
#ifdef NDEBUG
148-
try
149-
{
150-
const auto model = fdeep::load_model(model_path, true);
151-
const std::size_t warm_up_runs = 3;
152-
const std::size_t test_runs = 5;
153-
for (std::size_t i = 0; i < warm_up_runs; ++i)
154-
{
155-
const double duration = model.test_speed();
156-
std::cout << "Forward pass took "
157-
<< duration << " s." << std::endl;
158-
}
159-
double duration_sum = 0;
160-
std::cout << "Starting performance measurements." << std::endl;
161-
for (std::size_t i = 0; i < test_runs; ++i)
162-
{
163-
const double duration = model.test_speed();
164-
duration_sum += duration;
165-
std::cout << "Forward pass took "
166-
<< duration << " s." << std::endl;
167-
}
168-
const double duration_avg =
169-
duration_sum / static_cast<double>(test_runs);
170-
std::cout << "Forward pass took "
171-
<< duration_avg << " s on average." << std::endl;
172-
}
173-
catch (const std::exception& e)
174-
{
77+
<< duration_avg << " s on average." << std::endl;
78+
} catch (const std::exception& e) {
17579
std::cerr << "ERROR: " << e.what() << std::endl;
17680
error = true;
17781
}
178-
#else
179-
const auto model = fdeep::load_model(model_path, true);
180-
#endif
82+
#else
83+
const auto model = fdeep::load_model(model_path, true);
84+
#endif
18185
}
18286

183-
if (error)
184-
{
87+
if (error) {
18588
std::cout << "There were errors." << std::endl;
18689
return 1;
18790
}
18891
std::cout << "All imports and test OK." << std::endl;
189-
}
92+
}

0 commit comments

Comments
 (0)