Skip to content

Commit dba0515

Browse files
committedJul 21, 2024·
fix(exercise): 20
Signed-off-by: YdrMaster <[email protected]>
1 parent f847c0a commit dba0515

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎exercises/20_class_template/main.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
4949
auto t0 = Tensor4D(shape, data);
5050
auto t1 = Tensor4D(shape, data);
5151
t0 += t1;
52-
for (unsigned int i = 0; i < sizeof(data) / sizeof(int); i++) {
52+
for (auto i = 0u; i < sizeof(data) / sizeof(int); ++i) {
5353
ASSERT(t0.data[i] == data[i] * 2, "Tensor doubled by plus its self.");
5454
}
5555
}
@@ -80,7 +80,7 @@ int main(int argc, char **argv) {
8080
auto t0 = Tensor4D(s0, d0);
8181
auto t1 = Tensor4D(s1, d1);
8282
t0 += t1;
83-
for (unsigned int i = 0; i < sizeof(d0) / sizeof(int); i++) {
83+
for (auto i = 0u; i < sizeof(d0) / sizeof(int); ++i) {
8484
ASSERT(t0.data[i] == 7.f, "Every element of t0 should be 7 after adding t1 to it.");
8585
}
8686
}
@@ -102,8 +102,8 @@ int main(int argc, char **argv) {
102102
auto t0 = Tensor4D(s0, d0);
103103
auto t1 = Tensor4D(s1, d1);
104104
t0 += t1;
105-
for (unsigned int i = 0; i < sizeof(d0) / sizeof(int); i++) {
106-
ASSERT(t0.data[i] == t0.data[i] + 1, "Every element of t0 should be incremented by 1 after adding t1 to it.");
105+
for (auto i = 0u; i < sizeof(d0) / sizeof(int); ++i) {
106+
ASSERT(t0.data[i] == d0[i] + 1, "Every element of t0 should be incremented by 1 after adding t1 to it.");
107107
}
108108
}
109109
}

0 commit comments

Comments
 (0)
Please sign in to comment.