remove old imap
This commit is contained in:
parent
5fa1eb4034
commit
d788cc8c54
@ -10,7 +10,7 @@ using Base: @get!
|
|||||||
using DataFlow: Constant, constant
|
using DataFlow: Constant, constant
|
||||||
using DataFlow.Interpreter
|
using DataFlow.Interpreter
|
||||||
using DataFlow.Interpreter: Exception, totrace
|
using DataFlow.Interpreter: Exception, totrace
|
||||||
using Flux: imap, mapt
|
using Flux: mapt
|
||||||
|
|
||||||
# TODO: implement Julia's type promotion rules
|
# TODO: implement Julia's type promotion rules
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ end
|
|||||||
graph′(ctx::Context, args...) = @icatch ctx graph(ctx, args...)
|
graph′(ctx::Context, args...) = @icatch ctx graph(ctx, args...)
|
||||||
|
|
||||||
function tograph(model, args...; feedforward = false)
|
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(),
|
params = Dict(), stacks = Dict(),
|
||||||
feedforward = feedforward)
|
feedforward = feedforward)
|
||||||
out = @ithrow graph(ctx, model, mapt(mx.Variable, args)...)
|
out = @ithrow graph(ctx, model, mapt(mx.Variable, args)...)
|
||||||
|
@ -2,7 +2,6 @@ using Base: @get!
|
|||||||
using DataFlow: Constant, constant, Split
|
using DataFlow: Constant, constant, Split
|
||||||
using DataFlow.Interpreter
|
using DataFlow.Interpreter
|
||||||
using DataFlow.Interpreter: stack
|
using DataFlow.Interpreter: stack
|
||||||
using Flux: imap
|
|
||||||
using TensorFlow: RawTensor, TFException
|
using TensorFlow: RawTensor, TFException
|
||||||
|
|
||||||
# TODO: implement Julia's type promotion rules
|
# TODO: implement Julia's type promotion rules
|
||||||
@ -79,7 +78,7 @@ function interp(ctx, model, args...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tograph(model, args...; variables = false)
|
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)
|
params = ObjectIdDict(), stacks = Dict(), variables = variables)
|
||||||
out = interp(ctx, model, map(constant, args)...)
|
out = interp(ctx, model, map(constant, args)...)
|
||||||
return ctx[:params], ctx[:stacks], out
|
return ctx[:params], ctx[:stacks], out
|
||||||
|
@ -13,16 +13,6 @@ function astuples(xs)
|
|||||||
all(x->!(x==nothing), xs) ? xs : nothing
|
all(x->!(x==nothing), xs) ? xs : nothing
|
||||||
end
|
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...)
|
function interp(ctx, f, xs...)
|
||||||
g = graph(f)
|
g = graph(f)
|
||||||
@icatch(ctx, g ≠ nothing ?
|
@icatch(ctx, g ≠ nothing ?
|
||||||
|
Loading…
Reference in New Issue
Block a user