Skip to content

Commit

Permalink
clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Semyon1104 committed Oct 23, 2024
1 parent 6c695bb commit e912fe7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion app/AlexNet/reader_weights_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ int main() {
<< layer_name << "):" << std::endl;

try {
Tensor tensor = create_tensor_from_json(layer_data["weights"], Type::kFloat);
Tensor tensor =
create_tensor_from_json(layer_data["weights"], Type::kFloat);
// std::cout << tensor << std::endl;
} catch (const std::exception& e) {
std::cerr << "Error processing layer " << layer_name << ": " << e.what()
Expand Down
17 changes: 10 additions & 7 deletions app/Graph/graph_build.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#include <iostream>
#include <stdexcept>
#include <variant>
#include <vector>

#include "Weights_Reader/reader_weights.hpp"
#include "build.hpp"
#include "graph/graph.hpp"
#include "layers/ConvLayer.hpp"
#include "layers/EWLayer.hpp"
#include "layers/FCLayer.hpp"
#include "layers/InputLayer.hpp"
#include "layers/OutputLayer.hpp"
#include "layers/PoolingLayer.hpp"
#include <stdexcept>
#include <iostream>
#include <vector>
#include <variant>
#include "build.hpp"

using namespace itlab_2023;

Expand All @@ -23,13 +24,15 @@ void build_graph(Tensor input, Tensor output) {
for (const auto& layer_data : model_data) {

std::string layer_type = layer_data["type"];
Tensor tensor = create_tensor_from_json(layer_data["weights"], Type::kFloat);
Tensor tensor =
create_tensor_from_json(layer_data["weights"], Type::kFloat);

if (layer_type.find("Conv") != std::string::npos) {
Shape shape = tensor.get_shape();
Tensor tmp_values = make_tensor(tensor.get_values(), shape);
Tensor tmp_bias = make_tensor(tensor.get_bias());
layers.push_back(std::make_shared<ConvolutionalLayer>(1, 0, 0, tmp_values, tmp_bias));
layers.push_back(
std::make_shared<ConvolutionalLayer>(1, 0, 0, tmp_values, tmp_bias));
}

if (layer_type.find("Dense") != std::string::npos) {
Expand Down
5 changes: 3 additions & 2 deletions app/ReaderImage/reader_img_s.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "reader_img.hpp"
#include <stdexcept>
#include <stdexcept>

#include "reader_img.hpp"
using namespace cv;
void read(std::string& path) {
Mat image = imread(path);
Expand Down

0 comments on commit e912fe7

Please sign in to comment.