From c462b7d835ec402430895fb130654bdc85391242 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sat, 14 Dec 2024 11:58:31 +0530 Subject: [PATCH] fix: use functors for testing wrapped arrays --- lib/MLDataDevices/Project.toml | 2 +- lib/MLDataDevices/src/public.jl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/MLDataDevices/Project.toml b/lib/MLDataDevices/Project.toml index f9893771cb..79eb89571e 100644 --- a/lib/MLDataDevices/Project.toml +++ b/lib/MLDataDevices/Project.toml @@ -1,7 +1,7 @@ name = "MLDataDevices" uuid = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40" authors = ["Avik Pal and contributors"] -version = "1.6.4" +version = "1.6.5" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/lib/MLDataDevices/src/public.jl b/lib/MLDataDevices/src/public.jl index 068b8abf91..583b7dccb4 100644 --- a/lib/MLDataDevices/src/public.jl +++ b/lib/MLDataDevices/src/public.jl @@ -399,5 +399,7 @@ If `MLDataDevices.isleaf(x::T)` is not defined, then it will fall back to `Funct """ isleaf(x) = Functors.isleaf(x) -isleaf(::AbstractArray{T}) where {T} = isbitstype(T) || T <: Number # BigFloat and such are not bitstype -isleaf(::Adapt.WrappedArray) = false +function isleaf(x::AbstractArray{T}) where {T} + parent(x) !== x && return Functors.isleaf(x) + return isbitstype(T) || T <: Number # BigFloat and such are not bitstype +end