Skip to content

Commit 1902d75

Browse files
committed
Update the test cases.
1 parent 5ef370e commit 1902d75

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class Value : public std::enable_shared_from_this<Value> {
155155
}
156156

157157
friend std::ostream& operator<<(std::ostream& os, const Value& v) {
158-
os << "Value(data=" << v.data << ", grad=" << v.grad << ")";
158+
os << "Value(data=" << v.data << ", grad=" << v.grad << ")" << std::endl;
159159
return os;
160160
}
161161

test_Value.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ void test_sanity_check() {
99
y->backward();
1010
auto xmg = x, ymg = y;
1111

12-
std::cout << x << z << q << h << y << std::endl;
13-
assert(ymg->data == -34.0);
14-
assert(xmg->grad == -46.0);
12+
assert(ymg->data == -20.0);
13+
assert(xmg->grad == 46.0);
1514
}
1615

1716
void test_more_ops() {
@@ -33,7 +32,7 @@ void test_more_ops() {
3332
double tol = 1e-6;
3433
assert(std::abs(gmg->data - 24.70408163265306) < tol);
3534
assert(std::abs(amg->grad - 138.8338192419825) < tol);
36-
assert(std::abs(bmg->grad - 645.5773207547171) < tol);
35+
assert(std::abs(bmg->grad - 645.5772594752186) < tol);
3736
}
3837

3938
void test_duplicate_backprop() {

0 commit comments

Comments
 (0)