Skip to content

Commit

Permalink
Merge pull request #12 from UM-Bridge/marlenaweidenauer-patch-1-1
Browse files Browse the repository at this point in the history
delete zygote dependency in runtests.jl
  • Loading branch information
annereinarz authored May 15, 2024
2 parents 6cef54c + d119812 commit 4c5fc75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ version = "1.0.5"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
HTTP = "1.0, 1.1, 1.2"
JSON = "0.21"
Parameters = "0.12"
Zygote = "0.6"
julia = "1"

[extras]
Expand Down
7 changes: 2 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,14 @@ end

end


using Zygote # For automatic differentiation

# Define model for 1D function f(x) = x^2 that uses autodiff
model = UMBridge.Model(
name = "quadratic",
inputSizes = [1],
outputSizes = [1],
supportsGradient = true,
evaluate = (input, config) -> input[1]^2,
gradient = (outWrt, inWrt, input, sens, config) -> (Zygote.gradient(x -> x^2, input[1])[1] * sens[1])
gradient = (outWrt, inWrt, input, sens, config) -> 2*input[1][1] * sens[1]
)

function testserver_autodiff_gradient(models)
Expand Down Expand Up @@ -206,7 +203,7 @@ model = UMBridge.Model(
outputSizes = [2],
supportsJacobian = true,
evaluate = (input, config) -> [input[1]^2, input[2]^2],
applyJacobian = (outWrt, inWrt, input, vec, config) -> Zygote.jacobian(x -> [x[1]^2, x[2]^2], input)[1] * vec
applyJacobian = (outWrt, inWrt, input, vec, config) -> [2*input[1][1] 0 ; 0 2*input[2][1]] * vec
)

function testserver_autodiff_jacobian(models)
Expand Down

0 comments on commit 4c5fc75

Please sign in to comment.