We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c43f01e commit 0eb5a71Copy full SHA for 0eb5a71
test/grad.jl
@@ -44,7 +44,7 @@ Base.length(x::DummyType) = size(x.X, 1)
44
@test Ac == A
45
end
46
47
- @testset "multi vars jacobian" begin
+ @testset "multi vars jacobian/grad" begin
48
fdm = central_fdm(5, 1)
49
f1(x, y) = x * y + x
50
x, y = rand(3, 3), rand(3, 3)
@@ -57,6 +57,17 @@ Base.length(x::DummyType) = size(x.X, 1)
57
jac_xs = jacobian(fdm, f1, x, y)
58
@test jac_xs[1] ≈ jacobian(fdm, x->f1(x, y), x)
59
@test jac_xs[2] ≈ jacobian(fdm, y->f1(x, y), y)
60
+
61
+ f2(x, y) = sum(x * y + x)
62
+ x, y = rand(3, 3), rand(3, 3)
63
+ dxs = grad(fdm, f2, x, y)
64
+ @test dxs[1] ≈ grad(fdm, x->f2(x, y), x)
65
+ @test dxs[2] ≈ grad(fdm, y->f2(x, y), y)
66
67
+ x, y = rand(3, 3), 2
68
69
70
71
72
73
function test_to_vec(x)
0 commit comments