Skip to content

Commit d87031b

Browse files
authored
Merge pull request #262 from JuliaDiff/ox/fd_zt
if hit literal in forward demand use zero_tangent
2 parents ce14cd2 + e36d357 commit d87031b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/codegen/forward_demand.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ function forward_diff!(ir::IRCode, interp::AbstractInterpreter, irsv::IRInterpre
3939
return Δssa
4040
end
4141
function forward_diff!(ir::IRCode, interp::AbstractInterpreter, irsv::IRInterpretationState,
42-
val::Union{Integer, AbstractFloat}, order::Int;
42+
val, order::Int;
4343
custom_diff!, diff_cache)
44-
return zero(val)
45-
end
46-
function forward_diff!(ir::IRCode, interp::AbstractInterpreter, irsv::IRInterpretationState,
47-
@nospecialize(arg), order::Int;
48-
custom_diff!, diff_cache)
49-
return ChainRulesCore.NoTangent()
44+
return ChainRulesCore.zero_tangent(val)
5045
end
5146
function forward_diff!(ir::IRCode, interp::AbstractInterpreter, irsv::IRInterpretationState,
5247
arg::Argument, order::Int;

0 commit comments

Comments
 (0)