Skip to content

Commit

Permalink
move check for previous compilation to the correct location (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Mar 9, 2017
1 parent 1baad37 commit 09e7471
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/api/tape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,17 @@ stack has bubbled up to top level).
"""
function compile(t::AbstractTape)
ct = CompiledTape{gensym()}(t)
eval(current_module(), :(ReverseDiff.iscompiled($ct))) || compile(ct)
compile(ct)
return ct
end

function compile(ct::CompiledTape)
eval(current_module(), generate_forward_pass_method(typeof(ct), ct.tape.tape))
eval(current_module(), generate_reverse_pass_method(typeof(ct), ct.tape.tape))
eval(current_module(), :(ReverseDiff.iscompiled(ct::$(typeof(ct))) = true))
previously_compiled = eval(current_module(), :(ReverseDiff.iscompiled($ct)))
if !(previously_compiled)
eval(current_module(), generate_forward_pass_method(typeof(ct), ct.tape.tape))
eval(current_module(), generate_reverse_pass_method(typeof(ct), ct.tape.tape))
eval(current_module(), :(ReverseDiff.iscompiled(ct::$(typeof(ct))) = true))
end
return ct
end

Expand Down

0 comments on commit 09e7471

Please sign in to comment.