Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/overloads/ifelse_global.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ end

output_union(tx::AbstractTracer, y) = tx
output_union(x, ty::AbstractTracer) = ty
output_union(x, y) = x # neither branch is a tracer, so the result carries no dependency

## output union on AbstractArray outputs
# TODO: add test
Expand Down
1 change: 1 addition & 0 deletions test/test_gradient.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ T = DEFAULT_GRADIENT_TRACER
[1 1 1 1]
@test J(x -> ifelse(x[2] < x[3], x[1] + x[2], 1.0), [1 2 3 4]) == [1 1 0 0]
@test J(x -> ifelse(x[2] < x[3], 1.0, x[3] * x[4]), [1 2 3 4]) == [0 0 1 1]
@test J(x -> ifelse(x[2] < x[3], 1.0, 0.0) * x[1], [1 2 3 4]) == [1 0 0 0]

function f_ampgo07(x)
return (x[1] <= 0) * convert(eltype(x), Inf) +
Expand Down
Loading