File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ def check_forward(self, x_data):
53
53
54
54
loss = functions .sum (y ) # Minimize y
55
55
loss .backward ()
56
- self . assertTrue (( x .grad > 0 ). all () ) # Decrease x
56
+ numpy . testing . assert_array_less ( 0 , x .grad ) # Decrease x
57
57
x .cleargrad ()
58
58
59
59
loss = - functions .sum (y ) # Maximize y
60
60
loss .backward ()
61
- self . assertTrue (( x .grad > 0 ). all () ) # Decrease x
61
+ numpy . testing . assert_array_less ( 0 , x .grad ) # Decrease x
62
62
x .cleargrad ()
63
63
64
64
# Exceeding range_min
@@ -68,12 +68,12 @@ def check_forward(self, x_data):
68
68
69
69
loss = functions .sum (y ) # Minimize y
70
70
loss .backward ()
71
- self . assertTrue (( x .grad < 0 ). all () ) # Increase x
71
+ numpy . testing . assert_array_less ( x .grad , 0 ) # Increase x
72
72
x .cleargrad ()
73
73
74
74
loss = - functions .sum (y ) # Maximize y
75
75
loss .backward ()
76
- self . assertTrue (( x .grad < 0 ). all () ) # Increase x
76
+ numpy . testing . assert_array_less ( x .grad , 0 ) # Increase x
77
77
x .cleargrad ()
78
78
79
79
@condition .retry (3 )
You can’t perform that action at this time.
0 commit comments