@@ -6,10 +6,8 @@ int main() {
66 std::string json_file = MODEL_PATH_GOOGLENET_ONNX ;
77 it_lab_ai::json model_data = it_lab_ai::read_json (json_file);
88
9- std::cout << " Model contains " << model_data.size ()
10- << " layers:" << std::endl;
11- std::cout << " --------------------------------------------------"
12- << std::endl;
9+ std::cout << " Model contains " << model_data.size () << " layers:" << ' \n ' ;
10+ std::cout << " --------------------------------------------------" << ' \n ' ;
1311
1412 for (const auto & layer_data : model_data) {
1513 int layer_index = layer_data[" index" ];
@@ -20,11 +18,11 @@ int main() {
2018 bool has_value = layer_data.contains (" value" );
2119
2220 std::cout << " Layer " << layer_index << " : " << layer_name << " ("
23- << layer_type << " )" << std::endl ;
21+ << layer_type << " )" << ' \n ' ;
2422
2523 if (layer_data.contains (" attributes" ) &&
2624 !layer_data[" attributes" ].empty ()) {
27- std::cout << " Attributes:" << std::endl ;
25+ std::cout << " Attributes:" << ' \n ' ;
2826 for (const auto & [key, value] : layer_data[" attributes" ].items ()) {
2927 std::cout << " " << key << " : " ;
3028 if (value.is_array ()) {
@@ -42,16 +40,16 @@ int main() {
4240 } else if (value.is_string ()) {
4341 std::cout << value.get <std::string>();
4442 }
45- std::cout << std::endl ;
43+ std::cout << ' \n ' ;
4644 }
4745 }
4846
4947 if (has_value) {
5048 try {
5149 float value = layer_data[" value" ].get <float >();
52- std::cout << " Value: " << value << std::endl ;
50+ std::cout << " Value: " << value << ' \n ' ;
5351 } catch (const std::exception& e) {
54- std::cerr << " Error processing value: " << e.what () << std::endl ;
52+ std::cerr << " Error processing value: " << e.what () << ' \n ' ;
5553 }
5654 }
5755
@@ -60,20 +58,19 @@ int main() {
6058 it_lab_ai::Tensor tensor = it_lab_ai::create_tensor_from_json (
6159 layer_data, it_lab_ai::Type::kFloat );
6260
63- std::cout << " Weights shape: " << tensor.get_shape () << std::endl ;
61+ std::cout << " Weights shape: " << tensor.get_shape () << ' \n ' ;
6462
6563 if (!tensor.get_bias ().empty ()) {
66- std::cout << " Bias size: " << tensor.get_bias ().size () << std::endl ;
64+ std::cout << " Bias size: " << tensor.get_bias ().size () << ' \n ' ;
6765 }
6866 } catch (const std::exception& e) {
69- std::cerr << " Error processing weights: " << e.what () << std::endl ;
67+ std::cerr << " Error processing weights: " << e.what () << ' \n ' ;
7068 }
7169 } else if (!has_value) {
72- std::cout << " No weights or value" << std::endl ;
70+ std::cout << " No weights or value" << ' \n ' ;
7371 }
7472
75- std::cout << " --------------------------------------------------"
76- << std::endl;
73+ std::cout << " --------------------------------------------------" << ' \n ' ;
7774 }
7875
7976 return 0 ;
0 commit comments