|
98 | 98 | @testset "($x) * ($y)" for
|
99 | 99 | x in test_points, y in test_points
|
100 | 100 |
|
101 |
| - # all complex if any complex, was a limitation of FiniteDifferences? |
102 |
| - xx, yy = Base.promote(x, y) |
103 |
| - test_frule(*, xx, yy) |
104 |
| - test_rrule(*, xx, yy) |
| 101 | + # ensure all complex if any complex for FiniteDifferences |
| 102 | + x, y = Base.promote(x, y) |
105 | 103 |
|
106 |
| - # explicitly allow mixed types |
107 | 104 | test_frule(*, x, y)
|
108 | 105 | test_rrule(*, x, y)
|
109 |
| - rrule(*, x, y)[2](1)[2] isa typeof(x) |
110 |
| - rrule(*, x, y)[2](1)[3] isa typeof(y) |
111 | 106 | end
|
112 | 107 | end
|
113 | 108 |
|
|
141 | 136 | test_rrule(identity, Tuple(randn(T, 3)))
|
142 | 137 | end
|
143 | 138 |
|
144 |
| - @testset "one(::Number), zero(::Number)" for x in (-0.1, 6.4, 1.0+0.5im, -10.0+0im, 0.0+200im) |
| 139 | + @testset "Constants" for x in (-0.1, 6.4, 1.0+0.5im, -10.0+0im, 0.0+200im) |
145 | 140 | test_scalar(one, x)
|
146 | 141 | test_scalar(zero, x)
|
147 |
| - |
148 |
| - rrule(one, x)[2](1) === (NoTangent(), zero(x)) |
149 |
| - rrule(zero, x)[2](1) === (NoTangent(), zero(x)) |
150 | 142 | end
|
151 | 143 |
|
152 | 144 | @testset "muladd(x::$T, y::$T, z::$T)" for T in (Float64, ComplexF64)
|
153 |
| - test_frule(muladd, 10randn(T), randn(T), randn(T)) |
154 |
| - test_rrule(muladd, 10randn(T), randn(T), randn(T)) |
| 145 | + test_frule(muladd, 10randn(), randn(), randn()) |
| 146 | + test_rrule(muladd, 10randn(), randn(), randn()) |
155 | 147 | end
|
156 | 148 |
|
157 | 149 | @testset "fma" begin
|
|
171 | 163 | # to right
|
172 | 164 | test_frule(clamp, 4., 2., 3.)
|
173 | 165 | test_rrule(clamp, 4., 2., 3.)
|
174 |
| - |
175 |
| - # nonzero gradient at the boundaries |
176 |
| - @test frule((0,1,0,0), clamp, 2, 2, 3) == (2, 1) |
177 |
| - @test rrule(clamp, 2.0, 2, 3)[2](1)[2] == 1.0 |
178 |
| - |
179 |
| - @test frule((0,1,0,0), clamp, 3, 2, 3) == (3, 1) |
180 |
| - @test rrule(clamp, 3, 2, 3)[2](1)[2] == 1.0 |
181 | 166 | end
|
182 | 167 |
|
183 | 168 | @testset "rounding" begin
|
|
0 commit comments