From 45c5502f903fb2c65f044a502277cd58cf5a9102 Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Mon, 22 May 2017 16:18:41 +0100 Subject: [PATCH] obviate mapconst --- src/compiler/code.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/code.jl b/src/compiler/code.jl index 772dc01e..d3a1f688 100644 --- a/src/compiler/code.jl +++ b/src/compiler/code.jl @@ -1,4 +1,4 @@ -import DataFlow: mapconst, cse +import DataFlow: cse using MacroTools: @q export @net @@ -6,7 +6,7 @@ export @net function graphdef(ex, params = []) @capture(shortdef(ex), (args__,) -> body_) body = @> body MacroTools.flatten liftloops graphm DataFlow.il - body = mapconst(x -> x in params ? :(self.$x) : x, body) + body = map(x -> x in params ? :(self.$x) : x, body) return args, body end @@ -53,7 +53,7 @@ end import Lazy: groupby -reifyparams(v::IVertex) = mapconst(x -> x isa Param ? x.x : x, v) +reifyparams(v::IVertex) = map(x -> x isa Param ? x.x : x, v) # TODO: type hints for parameters @@ -69,14 +69,14 @@ function process_type(ex) $(build_type(T, params)) $(esc(:((self::$T)($(args...)) = $(build_forward(body, args))))) $(esc(:(Flux.update!(self::$T, η)))) = ($(map(p -> :(update!($self.$p, η)), pnames)...);) - $(esc(:(Flux.graph(self::$T)))) = $(DataFlow.constructor(mapconst(esc, makegraph(body, args, params)))) + $(esc(:(Flux.graph(self::$T)))) = $(DataFlow.constructor(map(esc, makegraph(body, args, params)))) nothing end end function process_anon(ex) args, body = graphdef(ex) - :(Capacitor($(DataFlow.constructor(mapconst(esc, makegraph(body, args)[1]))))) + :(Capacitor($(DataFlow.constructor(map(esc, makegraph(body, args)[1]))))) end function process_def(ex)