You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZScoreTransform and UnitRangeTransform do not support CuArrrays. For example, with StatsBase v0.33.2:
using CUDA
using StatsBase
A =5randn(2,4).+2
t =fit(ZScoreTransform,A;dims=2)
fails with
┌ Warning: Performing scalar operations on GPU arrays: This is very slow, consider disallowing these operations with `allowscalar(false)`
└ @ GPUArrays ~/.julia/packages/GPUArrays/jhRU7/src/host/indexing.jl:43
ERROR: MethodError: no method matching ZScoreTransform(::Int64, ::Int64, ::CuArray{Float32,1}, ::CuArray{Float32,1})
Closest candidates are:ZScoreTransform(::Int64, ::Int64, ::Array{T,1}, ::Array{T,1}) where T at /home/student/.julia/packages/StatsBase/EA8Mh/src/transformations.jl:58
Stacktrace:
[1] fit(::Type{ZScoreTransform}, ::CuArray{Float32,2}; dims::Int64, center::Bool, scale::Bool) at /home/student/.julia/packages/StatsBase/EA8Mh/src/transformations.jl:127
[2] top-level scope at REPL[4]:1
To fix this, the ZScoreTransform would have to allow AbstractArrays. Also, specifically for CuArrays, to prevent bad performance due to indexing, mean_and_std needs to be updated. See this gist for a possible implementation. I can put together a PR if desired. One question with regards to this change: Is it okay to replace stdm by Statistics.std using the mean option? This will facilitate solving this issue.
Fully resolved by PR #622 for ZScoreTransform. UnitRangeTransform has been generalized so it can handle CuArray.
Implement _compute_extrema to make UnitRangeTransform fully functional for CuArray. Note that this implementation is not included in StatsBase because it is not desirable to take on a dependency on CUDA.jl for this.
ZScoreTransform
andUnitRangeTransform
do not supportCuArrray
s. For example, withStatsBase
v0.33.2:fails with
To fix this, the
ZScoreTransform
would have to allowAbstractArray
s. Also, specifically forCuArray
s, to prevent bad performance due to indexing,mean_and_std
needs to be updated. See this gist for a possible implementation. I can put together a PR if desired. One question with regards to this change: Is it okay to replacestdm
byStatistics.std
using themean
option? This will facilitate solving this issue.See also JuliaGPU/CUDA.jl#426.
The text was updated successfully, but these errors were encountered: