1
1
module UtilsTests
2
2
3
- using ReverseDiffPrototype , Base. Test
3
+ using ReverseDiff , Base. Test
4
4
5
5
include (" utils.jl" )
6
6
@@ -107,17 +107,17 @@ xt, yt = track(x, tp), track(y, tp)
107
107
@test value (yt) == y
108
108
109
109
x_sim, y_sim = similar (x), similar (y)
110
- RDP . value! (x_sim, xt)
111
- RDP . value! (y_sim, yt)
110
+ ReverseDiff . value! (x_sim, xt)
111
+ ReverseDiff . value! (y_sim, yt)
112
112
@test x_sim == x
113
113
@test y_sim == y
114
114
115
115
@test all (adjoint (xt) .== zero (first (x)))
116
116
@test all (adjoint (yt) .== zero (first (y)))
117
117
118
118
x_sim, y_sim = similar (x), similar (y)
119
- RDP . adjoint! (x_sim, xt)
120
- RDP . adjoint! (y_sim, yt)
119
+ ReverseDiff . adjoint! (x_sim, xt)
120
+ ReverseDiff . adjoint! (y_sim, yt)
121
121
@test all (x_sim .== zero (first (x)))
122
122
@test all (y_sim .== zero (first (y)))
123
123
@@ -140,22 +140,22 @@ RDP.adjoint!(y_sim, yt)
140
140
tp = Tape ()
141
141
ntp = Nullable (tp)
142
142
143
- @test tracked_is (RDP . seed! (Tracked (1 , 0 , ntp)), Tracked (1 , 1 , ntp))
143
+ @test tracked_is (ReverseDiff . seed! (Tracked (1 , 0 , ntp)), Tracked (1 , 1 , ntp))
144
144
145
145
node = TapeNode (+ , (Tracked (2 , ntp), Tracked (1 , ntp)), Tracked (3 , ntp), nothing )
146
- @test tracked_is (RDP . seed! (node). outputs, Tracked (3 , 1 , ntp))
146
+ @test tracked_is (ReverseDiff . seed! (node). outputs, Tracked (3 , 1 , ntp))
147
147
148
- @test tracked_is (RDP . unseed! (Tracked (1 , 1 , ntp)), Tracked (1 , 0 , ntp))
148
+ @test tracked_is (ReverseDiff . unseed! (Tracked (1 , 1 , ntp)), Tracked (1 , 0 , ntp))
149
149
150
150
node = TapeNode (+ , (Tracked (2 , 2 , ntp), Tracked (1 , 3 , ntp)), Tracked (3 , 4 , ntp), nothing )
151
- RDP . unseed! (node)
151
+ ReverseDiff . unseed! (node)
152
152
@test adjoint (node. inputs[1 ]) === 0
153
153
@test adjoint (node. inputs[2 ]) === 0
154
154
@test adjoint (node. outputs) === 0
155
155
156
156
tp2 = [TapeNode (+ , (Tracked (2 , 2 , ntp), Tracked (1 , 3 , ntp)), Tracked (3 , 4 , ntp), nothing ),
157
157
TapeNode (+ , Tracked (1.0 , 3.0 , ntp), (Tracked (51.4 , 3.1 , ntp), Tracked (3 , 4 , ntp)), nothing )]
158
- RDP . unseed! (tp2)
158
+ ReverseDiff . unseed! (tp2)
159
159
@test adjoint (tp2[1 ]. inputs[1 ]) === 0
160
160
@test adjoint (tp2[1 ]. inputs[2 ]) === 0
161
161
@test adjoint (tp2[1 ]. outputs) === 0
@@ -173,26 +173,26 @@ genarr = () -> [Tracked(rand(), rand(), ntp) for i in 1:3]
173
173
174
174
x, y = genarr (), genarr ()
175
175
xadj, yadj = adjoint (x), adjoint (y)
176
- RDP . extract_and_decrement_adjoint! (x, y)
176
+ ReverseDiff . extract_and_decrement_adjoint! (x, y)
177
177
@test adjoint (x) == (xadj - yadj)
178
178
179
179
x, y = genarr (), genarr ()
180
180
xadj, yadj = adjoint (x), adjoint (y)
181
- RDP . extract_and_increment_adjoint! (x, y)
181
+ ReverseDiff . extract_and_increment_adjoint! (x, y)
182
182
@test adjoint (x) == (xadj + yadj)
183
183
184
184
x, y = genarr (), rand (3 )
185
185
xadj = adjoint (x)
186
- RDP . increment_adjoint! (x, y)
186
+ ReverseDiff . increment_adjoint! (x, y)
187
187
@test adjoint (x) == (xadj + y)
188
188
189
189
x = genarr ()
190
190
xadj = adjoint (x)
191
- RDP . increment_adjoint! (x, 3 )
191
+ ReverseDiff . increment_adjoint! (x, 3 )
192
192
@test adjoint (x) == (xadj + 3 )
193
193
194
194
k = Tracked (1 , 3 , ntp)
195
- RDP . increment_adjoint! (k, 3 )
195
+ ReverseDiff . increment_adjoint! (k, 3 )
196
196
@test tracked_is (k, Tracked (1 , 6 , ntp))
197
197
198
198
# ###########################################################################################
0 commit comments