remove old imap

This commit is contained in:
Mike J Innes 2017-05-30 16:59:12 +01:00
parent 5fa1eb4034
commit d788cc8c54
3 changed files with 3 additions and 14 deletions

View File

@ -10,7 +10,7 @@ using Base: @get!
using DataFlow: Constant, constant
using DataFlow.Interpreter
using DataFlow.Interpreter: Exception, totrace
using Flux: imap, mapt
using Flux: mapt
# TODO: implement Julia's type promotion rules
@ -92,7 +92,7 @@ end
graph(ctx::Context, args...) = @icatch ctx graph(ctx, args...)
function tograph(model, args...; feedforward = false)
ctx = Context(mux(iline, ilambda, imap, iargs, ituple, graph),
ctx = Context(mux(iline, ilambda, iargs, ituple, graph),
params = Dict(), stacks = Dict(),
feedforward = feedforward)
out = @ithrow graph(ctx, model, mapt(mx.Variable, args)...)

View File

@ -2,7 +2,6 @@ using Base: @get!
using DataFlow: Constant, constant, Split
using DataFlow.Interpreter
using DataFlow.Interpreter: stack
using Flux: imap
using TensorFlow: RawTensor, TFException
# TODO: implement Julia's type promotion rules
@ -79,7 +78,7 @@ function interp(ctx, model, args...)
end
function tograph(model, args...; variables = false)
ctx = Context(mux(iline, ilambda, imap, interp),
ctx = Context(mux(iline, ilambda, interp),
params = ObjectIdDict(), stacks = Dict(), variables = variables)
out = interp(ctx, model, map(constant, args)...)
return ctx[:params], ctx[:stacks], out

View File

@ -13,16 +13,6 @@ function astuples(xs)
all(x->!(x==nothing), xs) ? xs : nothing
end
function imap(cb, ctx, ::typeof(map), f, xs...)
f, xs = interpv(ctx, (f, xs))
xs = astuples(xs)
xs nothing ?
group(map(f, xs...)...) :
cb(ctx, map, constant(f), xs...)
end
imap(f, args...) = f(args...)
function interp(ctx, f, xs...)
g = graph(f)
@icatch(ctx, g nothing ?