Skip to content

Commit 20a615a

Browse files
committed
Clean up tree conversion
1 parent abf58b2 commit 20a615a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/tree_map.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ function convert(
295295
end
296296
return tree_mapreduce(
297297
t -> if t.constant
298-
Node(T1, 0, true, maybe_convert(t.val::T2, T1, T2))
298+
Node(T1, 0, true, convert(T1, t.val::T2))
299299
else
300300
Node(T1, 0, false, nothing, t.feature)
301301
end,
@@ -306,11 +306,6 @@ function convert(
306306
preserve_sharing,
307307
)
308308
end
309-
@inline function maybe_convert(val, ::Type{T1}, ::Type{T2}) where {T1,T2}
310-
# e.g., we don't want to convert Float32 to Union{Float32,Vector{Float32}}!
311-
!(T2 <: T1) && return convert(T1, val)
312-
return val
313-
end
314309
(::Type{Node{T}})(tree::Node; kws...) where {T} = convert(Node{T}, tree; kws...)
315310

316311
function reduce(f, tree::Node; init=nothing)

0 commit comments

Comments
 (0)