Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 9ff2b50

Browse files
isleaf
1 parent 71ed455 commit 9ff2b50

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/MLDataDevices.jl

+3
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ export get_device, get_device_type
2525

2626
export DeviceIterator
2727

28+
### uncomment below when min supported julia version is >=1.11
29+
# public isleaf
30+
2831
end

src/public.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ for (dev) in (:CPU, :CUDA, :AMDGPU, :Metal, :oneAPI, :XLA)
337337
end
338338
(D::$(ldev))(x::Union{Tuple, NamedTuple}) = map(D, x)
339339
function (D::$(ldev))(x)
340-
Functors.isleaf(x) && return Adapt.adapt(D, x)
340+
isleaf(x) && return Adapt.adapt(D, x)
341341
return Functors.fmap(D, x)
342342
end
343343
end
@@ -370,3 +370,6 @@ for T in (AMDGPUDevice, AMDGPUDevice{Nothing}, CUDADevice,
370370
CUDADevice{Nothing}, MetalDevice, oneAPIDevice)
371371
@eval Adapt.adapt_storage(to::$(T), x::AbstractRange) = Adapt.adapt(to, collect(x))
372372
end
373+
374+
375+
isleaf(x) = Functors.isleaf(x)

0 commit comments

Comments
 (0)