Skip to content

Commit dbdbb46

Browse files
committed
tidy
1 parent 142704e commit dbdbb46

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

app/Graph/build.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "build.hpp"
22

3-
void build_graph(Tensor input, Tensor output) {
3+
void build_graph(Tensor& input, Tensor& output) {
44
std::vector<std::shared_ptr<Layer>> layers;
55

66
std::string json_file = MODEL_PATH;
@@ -35,38 +35,38 @@ void build_graph(Tensor input, Tensor output) {
3535

3636
if (layer_type.find("Dense") != std::string::npos) {
3737
Tensor tmp_values = tensor;
38-
std::vector<float> Values_vector = *tensor.as<float>();
39-
std::vector<std::vector<float>> Values_vector_2d(
38+
std::vector<float> values_vector = *tensor.as<float>();
39+
std::vector<std::vector<float>> values_vector_2d(
4040
tensor.get_shape()[0],
4141
std::vector<float>(tensor.get_shape()[1], 0.0f));
4242
int q = 0;
43-
for (size_t i = 0; i < Values_vector.size(); i++) {
44-
Values_vector_2d[q][i - (q * tensor.get_shape()[1])] = Values_vector[i];
43+
for (size_t i = 0; i < values_vector.size(); i++) {
44+
values_vector_2d[q][i - (q * tensor.get_shape()[1])] = values_vector[i];
4545
if ((i + 1) % tensor.get_shape()[1] == 0) {
4646
q++;
4747
}
4848
}
49-
std::vector<std::vector<float>> Values_vector_2d_2(
49+
std::vector<std::vector<float>> values_vector_2d_2(
5050
tensor.get_shape()[1],
5151
std::vector<float>(tensor.get_shape()[0], 0.0f));
5252

5353
for (size_t i = 0; i < tensor.get_shape()[0]; ++i) {
5454
for (size_t j = 0; j < tensor.get_shape()[1]; ++j) {
55-
Values_vector_2d_2[j][i] = Values_vector_2d[i][j];
55+
values_vector_2d_2[j][i] = values_vector_2d[i][j];
5656
}
5757
}
58-
std::vector<float> Values_vector_1d(
59-
tensor.get_shape()[0] * tensor.get_shape()[1], 0.0f);
58+
std::vector<float> values_vector_1d(
59+
tensor.get_shape()[0] * tensor.get_shape()[1], 0.0F);
6060
int index_1d = 0;
6161

6262
for (size_t j = 0; j < tensor.get_shape()[1]; ++j) {
6363
for (size_t k = 0; k < tensor.get_shape()[0]; ++k) {
64-
Values_vector_1d[index_1d++] = Values_vector_2d_2[j][k];
64+
values_vector_1d[index_1d++] = values_vector_2d_2[j][k];
6565
}
6666
}
6767

6868
Shape shape_fc({tensor.get_shape()[1], tensor.get_shape()[0]});
69-
Tensor values = make_tensor<float>(Values_vector_1d, shape_fc);
69+
Tensor values = make_tensor<float>(values_vector_1d, shape_fc);
7070
Tensor tmp_bias = make_tensor(tensor.get_bias());
7171

7272
auto fc_layer = std::make_shared<FCLayer>(values, tmp_bias);

app/Graph/build.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#include "layers/OutputLayer.hpp"
1616
#include "layers/PoolingLayer.hpp"
1717

18-
void build_graph(Tensor input, Tensor output);
18+
void build_graph(Tensor& input, Tensor& output);

src/Weights_Reader/reader_weights.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ Tensor create_tensor_from_json(const json& j, Type type) {
107107
}
108108
std::cout << std::endl;
109109

110-
if (expected_size == 1 && shape.empty()) {
111-
expected_size = 0;
112-
}
113110
extract_bias_from_json(j, bias);
114111
std::cout << "Extracted bias size: " << bias.size() << std::endl;
115112
Shape sh(shape);

0 commit comments

Comments
 (0)