model macro

This commit is contained in:
Mike J Innes 2016-08-22 14:49:34 +01:00
parent 787d563ac1
commit 4b9a2b865d
1 changed files with 6 additions and 6 deletions

View File

@ -71,12 +71,12 @@ function process_type(ex)
(self::$T)($(args...),) = $(syntax(build_forward(body, args))) (self::$T)($(args...),) = $(syntax(build_forward(body, args)))
back!(self::$T, Δ, $(args...)) = $(syntax(build_backward(body, args[1], params))) back!(self::$T, Δ, $(args...)) = $(syntax(build_backward(body, args[1], params)))
$(build_update(T, params)) $(build_update(T, params))
end |> longdef
graph(::$T) = $(Flow.constructor(makegraph(body, args))) graph(::$T) = $(Flow.constructor(makegraph(body, args)))
nothing
end |> esc
end end
# process_type(:(type Sigmoid macro model(ex)
# W isexpr(ex, :type) ? process_type(ex) :
# b error("Unsupported model expression $ex")
# x -> σ(W*x+b) end
# end)) |> prettify