avoid line numbers in runmodel

This commit is contained in:
Mike J Innes 2017-03-09 01:10:44 +00:00
parent 5c548fe1c4
commit 3f919aa81e

View File

@ -1,4 +1,5 @@
import DataFlow: mapconst, cse import DataFlow: mapconst, cse
using MacroTools: @q
export @net, @ml export @net, @ml
@ -72,7 +73,7 @@ function process_type(ex)
self = esc(:self) self = esc(:self)
quote quote
$(build_type(T, params)) $(build_type(T, params))
$(esc(:(Flux.runmodel(self::$T, $(args...)) = $(build_forward(body, args))))) $(@q $(esc(:(Flux.runmodel(self::$T, $(args...)) = $(build_forward(body, args))))))
($self::$(esc(T)))($(args...)) = runrawbatched((xs...) -> runmodel($self, xs...), $(args...)) ($self::$(esc(T)))($(args...)) = runrawbatched((xs...) -> runmodel($self, xs...), $(args...))
$(esc(:(Flux.update!(self::$T, η)))) = ($(map(p -> :(update!($self.$p, η)), pnames)...);) $(esc(:(Flux.update!(self::$T, η)))) = ($(map(p -> :(update!($self.$p, η)), pnames)...);)
$(esc(:(Flux.graph(self::$T)))) = $(DataFlow.constructor(mapconst(esc, makegraph(body, args)))) $(esc(:(Flux.graph(self::$T)))) = $(DataFlow.constructor(mapconst(esc, makegraph(body, args))))