|
520 | 520 |
|
521 | 521 | @testset "Simple Exception" begin |
522 | 522 | f_simple_exc(x, i) = x[i] |
| 523 | + y = [1.0, 2.0] |
523 | 524 | f_x = zero.(y) |
524 | 525 | @test_throws BoundsError autodiff(Reverse, f_simple_exc, Duplicated(y, f_x), Const(0)) |
525 | 526 | end |
@@ -1570,7 +1571,12 @@ end |
1570 | 1571 | end |
1571 | 1572 |
|
1572 | 1573 | @testset "Vector to Number" for f in DiffTests.VECTOR_TO_NUMBER_FUNCS |
1573 | | - test_matrix_to_number(f, y; rtol=1e-6, atol=1e-6) |
| 1574 | + # `test_matrix_to_number` contains a `@generated` function, we wrap it in a |
| 1575 | + # `Ref{Any}` container only to be able to catch and test the warnings emitted during |
| 1576 | + # compilation in the body of the function. |
| 1577 | + test_mat2num = Ref{Any}(test_matrix_to_number) |
| 1578 | + warn_msg = f === DiffTests.vec2num_3 ? r"Using fallback BLAS replacements for" : "" |
| 1579 | + @test_warn warn_msg test_mat2num[](f, y; rtol = 1.0e-6, atol = 1.0e-6) |
1574 | 1580 | end |
1575 | 1581 |
|
1576 | 1582 | @testset "Matrix to Number" for f in DiffTests.MATRIX_TO_NUMBER_FUNCS |
@@ -3326,7 +3332,7 @@ function uns_sum2(x::Array{T})::T where T |
3326 | 3332 | return v |
3327 | 3333 | end |
3328 | 3334 |
|
3329 | | -function uns_ad_forward(scale_diag::Vector{T}, c) where T |
| 3335 | +function uns_ad_forward(scale_diag::Vector{T}, c) where T |
3330 | 3336 | res = uns_mymean(uns_sum2, [scale_diag,], T, c) |
3331 | 3337 | return res |
3332 | 3338 | end |
|
0 commit comments