basic tree
This commit is contained in:
parent
7e9468d8f8
commit
8b05317895
1
REQUIRE
1
REQUIRE
@ -6,3 +6,4 @@ NNlib
|
|||||||
ForwardDiff
|
ForwardDiff
|
||||||
Requires
|
Requires
|
||||||
ZipFile
|
ZipFile
|
||||||
|
AbstractTrees
|
||||||
|
@ -3,5 +3,6 @@ module Batches
|
|||||||
import ..Flux
|
import ..Flux
|
||||||
|
|
||||||
include("batch.jl")
|
include("batch.jl")
|
||||||
|
include("tree.jl")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
12
src/batches/tree.jl
Normal file
12
src/batches/tree.jl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using AbstractTrees
|
||||||
|
|
||||||
|
struct Tree{T}
|
||||||
|
value::T
|
||||||
|
children::Vector{Tree{T}}
|
||||||
|
end
|
||||||
|
|
||||||
|
Tree(x::T, xs::Vector{Tree{T}} = Tree{T}[]) where T = Tree{T}(x, xs)
|
||||||
|
Tree(x::T, xs::Tree{T}...) where T = Tree{T}(x, [xs...])
|
||||||
|
|
||||||
|
AbstractTrees.children(t::Tree) = t.children
|
||||||
|
AbstractTrees.printnode(io::IO, t::Tree) = show(io, t.value)
|
Loading…
Reference in New Issue
Block a user