closes #198
This commit is contained in:
parent
1a0ddbe4f1
commit
0802b4d5cf
@ -8,8 +8,8 @@ mapchildren(f, x::Tuple) = map(f, x)
|
||||
|
||||
function treelike(T, fs = fieldnames(T))
|
||||
@eval current_module() begin
|
||||
children(x::$T) = ($([:(x.$f) for f in fs]...),)
|
||||
mapchildren(f, x::$T) = $T(f.(children(x))...)
|
||||
Flux.children(x::$T) = ($([:(x.$f) for f in fs]...),)
|
||||
Flux.mapchildren(f, x::$T) = $T(f.($children(x))...)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user