Skip to content

Commit

Permalink
fix(exercise): 20
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Jul 21, 2024
1 parent f847c0a commit dba0515
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exercises/20_class_template/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char **argv) {
auto t0 = Tensor4D(shape, data);
auto t1 = Tensor4D(shape, data);
t0 += t1;
for (unsigned int i = 0; i < sizeof(data) / sizeof(int); i++) {
for (auto i = 0u; i < sizeof(data) / sizeof(int); ++i) {
ASSERT(t0.data[i] == data[i] * 2, "Tensor doubled by plus its self.");
}
}
Expand Down Expand Up @@ -80,7 +80,7 @@ int main(int argc, char **argv) {
auto t0 = Tensor4D(s0, d0);
auto t1 = Tensor4D(s1, d1);
t0 += t1;
for (unsigned int i = 0; i < sizeof(d0) / sizeof(int); i++) {
for (auto i = 0u; i < sizeof(d0) / sizeof(int); ++i) {
ASSERT(t0.data[i] == 7.f, "Every element of t0 should be 7 after adding t1 to it.");
}
}
Expand All @@ -102,8 +102,8 @@ int main(int argc, char **argv) {
auto t0 = Tensor4D(s0, d0);
auto t1 = Tensor4D(s1, d1);
t0 += t1;
for (unsigned int i = 0; i < sizeof(d0) / sizeof(int); i++) {
ASSERT(t0.data[i] == t0.data[i] + 1, "Every element of t0 should be incremented by 1 after adding t1 to it.");
for (auto i = 0u; i < sizeof(d0) / sizeof(int); ++i) {
ASSERT(t0.data[i] == d0[i] + 1, "Every element of t0 should be incremented by 1 after adding t1 to it.");
}
}
}

0 comments on commit dba0515

Please sign in to comment.