Skip to content

Commit 2217614

Browse files
committed
tests
1 parent 5f4a4e8 commit 2217614

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/complex.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ using Zygote, Test, LinearAlgebra
22

33
@test gradient(x -> real(abs(x)*exp(im*angle(x))), 10+20im)[1] 1
44
@test gradient(x -> imag(real(x)+0.3im), 0.3)[1] 0
5-
@test gradient(x -> imag(conj(x)+0.3im), 0.3)[1] -1im
6-
@test gradient(x -> abs((imag(x)+0.3)), 0.3)[1] == 1im
5+
@test gradient(x -> imag(conj(x)+0.3im), 0.3 + 0im)[1] -1im
6+
@test gradient(x -> imag(conj(x)+0.3im), 0.3)[1] 0 # projected to zero
7+
@test gradient(x -> abs((imag(x)+0.3)), 0.3 + 0im)[1] 1im
8+
@test gradient(x -> abs((imag(x)+0.3)), 0.3)[1] 0
79

810
@test gradient(a -> real((a*conj(a))), 0.3im)[1] == 0.6im
911
@test gradient(a -> real((a.*conj(a))), 0.3im)[1] == 0.6im

0 commit comments

Comments
 (0)