factor out var creation
This commit is contained in:
parent
12cde694b3
commit
4fb51d1752
@ -57,12 +57,14 @@ end
|
|||||||
|
|
||||||
register(ctx::Context, node) = node
|
register(ctx::Context, node) = node
|
||||||
|
|
||||||
function graph{T<:AArray}(ctx::Context, p::Constant{Flux.Param{T}})
|
function var(ctx::Context, p::Flux.Param)
|
||||||
id = gensym()
|
id = gensym()
|
||||||
ctx[:params][id] = p.value.x
|
ctx[:params][id] = p.x
|
||||||
return mx.Variable(id)
|
return mx.Variable(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
graph{T<:AArray}(ctx::Context, p::Constant{Flux.Param{T}}) = var(ctx, p.value)
|
||||||
|
|
||||||
graph(ctx::Context, p::Constant) = node(p.value)
|
graph(ctx::Context, p::Constant) = node(p.value)
|
||||||
|
|
||||||
function graph(ctx::Context, model, args...)
|
function graph(ctx::Context, model, args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user