model macro
This commit is contained in:
parent
787d563ac1
commit
4b9a2b865d
|
@ -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
|
|
||||||
|
|
Loading…
Reference in New Issue