model -> net
This commit is contained in:
parent
066ecafd71
commit
b115d8ce3f
|
@ -2,7 +2,7 @@
|
|||
|
||||
import Flow: mapconst, cse
|
||||
|
||||
export @model
|
||||
export @net
|
||||
|
||||
function process_func(ex, params = [])
|
||||
@capture(shortdef(ex), (args__,) -> body_)
|
||||
|
@ -85,7 +85,7 @@ function process_anon(ex)
|
|||
:(Flux.Capacitor($(Flow.constructor(makegraph(body, args))))) |> esc
|
||||
end
|
||||
|
||||
macro model(ex)
|
||||
macro net(ex)
|
||||
isexpr(ex, :type) ? process_type(ex) :
|
||||
isexpr(ex, :->, :function) ? process_anon(ex) :
|
||||
error("Unsupported model expression $ex")
|
||||
|
|
|
@ -59,7 +59,7 @@ end
|
|||
#
|
||||
# break!(atomise(r)) |> syntax |> prettify |> display
|
||||
|
||||
@model type Recurrent
|
||||
@net type Recurrent
|
||||
Wx; Wh; B
|
||||
hidden
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ export Dense
|
|||
|
||||
# TODO: type hints for parameters
|
||||
|
||||
@model type Dense
|
||||
@net type Dense
|
||||
W
|
||||
b
|
||||
x -> x*W + b
|
||||
|
@ -14,7 +14,7 @@ Dense(in::Integer, out::Integer; init = initn) =
|
|||
Base.show(io::IO, d::Dense) =
|
||||
print(io, "Dense($(size(d.W.x,1)),$(size(d.W.x,2)))")
|
||||
|
||||
@model type Sigmoid
|
||||
@net type Sigmoid
|
||||
layer::Model
|
||||
x -> σ(layer(x))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue