Skip to content

Commit 69cd525

Browse files
committed
clang'
1 parent 9cd0c87 commit 69cd525

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

include/layers/Tensor.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class Tensor {
8282
if (a.size() != values_.size()) {
8383
throw std::invalid_argument("Incorrect vector size given to Tensor");
8484
}
85+
values_ = a;
8586
if (bias.size() != shape_[shape_.dims() - 1]) {
8687
throw std::invalid_argument(
8788
"Bias size does not match the last dimension of the shape");

src/Weights_Reader/reader_weights.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ void extract_values_without_bias(const json& j, std::vector<float>& values) {
8080
std::cout << "Values size after extraction: " << values.size() << std::endl;
8181
}
8282

83-
8483
// Функция для определения формы из JSON
8584
void parse_json_shape(const json& j, std::vector<size_t>& shape, size_t dim) {
8685
// Если dim == 0, просто проверяем первый уровень
@@ -117,7 +116,6 @@ void parse_json_shape(const json& j, std::vector<size_t>& shape, size_t dim) {
117116
}
118117
}
119118

120-
121119
void extract_bias_from_json(const json& j, std::vector<float>& bias) {
122120
if (j.is_array()) {
123121
if (!j.empty() && j.back().is_array()) {
@@ -160,23 +158,16 @@ Tensor create_tensor_from_json(const json& j, Type type) {
160158
if (expected_size == 1 && shape.empty()) {
161159
expected_size = 0;
162160
}
163-
164161
std::cout << "Expected size: " << expected_size << std::endl;
165-
166-
167162
try {
168163
extract_bias_from_json(j, bias);
169164
std::cout << "Extracted bias size: " << bias.size() << std::endl;
170165
} catch (const std::exception& e) {
171166
std::cout << "No bias found or error extracting bias: " << e.what()
172167
<< std::endl;
173168
}
174-
175-
176169
Shape sh(shape);
177-
178170
return make_tensor<float>(vals, sh, bias);
179-
180171
}
181172
throw std::invalid_argument("Unsupported type or invalid JSON format");
182173
}

test/model_read/model_read.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ TEST(ExtractValuesFromJsonTests, HandlesFlatArray) {
6565
EXPECT_EQ(values, expected);
6666
}
6767

68-
6968
TEST(ExtractValuesFromJsonTests, HandlesNestedArray) {
7069
json j = json::array({{1.0, 2.0}, {3.0, 4.0}});
7170
std::vector<float> values;
@@ -81,6 +80,3 @@ TEST(ParseJsonShapeTests, HandlesEmptyArray) {
8180
std::vector<size_t> expected = {0};
8281
EXPECT_EQ(shape, expected);
8382
}
84-
85-
86-

0 commit comments

Comments
 (0)