|
634 | 634 | # in typeassert, expected Int64, got a value of type Nothing
|
635 | 635 | @test_broken jacobicheck(-, A, B)
|
636 | 636 | end
|
637 |
| - |
638 |
| - |
639 |
| - |
640 |
| - |
641 |
| - |
642 |
| - |
643 |
| - |
644 |
| - |
645 |
| - |
646 |
| - |
647 |
| - |
648 |
| - |
649 |
| - |
650 |
| - |
651 |
| -@testset "LinearAlgebra.det" begin |
652 |
| - @test jacobicheck(det, (4, 4)) |
653 |
| - @test jacobicheck(logdet, map(x -> x*x'+I, (randn(4, 4),))[1]) |
654 |
| - @test jacobicheck(x -> logabsdet(x)[1], (4, 4)) |
655 |
| - @test gradient(det, 2.0)[1] == 1 |
656 |
| - @test gradient(logdet, 2.0)[1] == 0.5 |
657 |
| -end |
658 |
| - |
659 |
| -@testset "kron" begin |
660 |
| - # FIXME: fail with |
661 |
| - # TypeError: in typeassert, expected Int64, got a value of type Nothing |
662 |
| - @test_broken jacobicheck(kron, 5, 3) |
663 |
| - @test_broken jacobicheck(kron, rand(5), rand(3), rand(8)) |
664 |
| - @test_broken jacobicheck(kron, rand(5,1), rand(3,1)) |
665 |
| - @test_broken jacobicheck(kron, rand(5,1), rand(3,1), rand(8,1)) |
666 |
| - @test_broken jacobicheck(kron, rand(5,2), rand(3,2), rand(8,2)) |
667 |
| -end |
668 |
| - |
669 |
| - |
670 |
| - |
671 |
| -# FIXME: complex numbers; put somewhere |
672 |
| -@test gradcheck((a,b)->sum(reim(acosh(complex(a[1], b[1])))), [-2.0], [1.0]) |
673 |
| -#@testset "$f(::AbstractArray)" for f in (real, conj, imag) |
674 |
| -# rng, N = MersenneTwister(123456), 3 |
675 |
| -# Ts = (Float64, ComplexF64) |
676 |
| -# @testset "$f(::Array{$IT})" for IT in Ts |
677 |
| -# A = randn(IT, N, N) |
678 |
| -# y, back = Zygote.pullback(f, A) |
679 |
| -# y2, back2 = Zygote.pullback(x->f.(x), A) |
680 |
| -# @test y == y2 |
681 |
| -# @testset "back(::Array{$BT})" for BT in Ts |
682 |
| -# ȳ = randn(BT, N, N) |
683 |
| -# @test back(ȳ)[1] == back2(ȳ)[1] |
684 |
| -# end |
685 |
| -# end |
686 |
| -#end |
687 |
| - |
688 |
| - |
689 |
| -# FIXME: misc tests |
690 |
| -@test jacobicheck(x -> x', rand(5)) |
691 |
| - |
692 |
| - |
693 |
| -# FIXME: include those? |
694 |
| -# @testset "println, show, string, etc" begin |
695 |
| -# function foo(x) |
696 |
| -# Base.show(x) |
697 |
| -# Base.print(x) |
698 |
| -# Base.print(stdout, x) |
699 |
| -# Base.println(x) |
700 |
| -# Base.println(stdout, x) |
701 |
| -# Core.show(x) |
702 |
| -# Core.print(x) |
703 |
| -# Core.println(x) |
704 |
| -# return x |
705 |
| -# end |
706 |
| -# gradcheck(f, xs::AbstractArray...) = gradcheck((xs...) -> sum(sin.(f(xs...))), xs...) |
707 |
| -# println("The following printout is from testing that `print` doesn't upset gradients:") |
708 |
| -# @test gradcheck(foo, [5.0]) |
709 |
| -# |
710 |
| -# function bar(x) |
711 |
| -# string(x) |
712 |
| -# repr(x) |
713 |
| -# return x |
714 |
| -# end |
715 |
| -# @test gradcheck(bar, [5.0]) |
716 |
| -# end |
0 commit comments