Hello,
So I’m trying this simple accumulate function on a CuArray:
julia> using CUDA
julia> d_d = cu(rand(10,20));
julia> accumulate((a,d) -> d + 0.99*0.95*a, d_d, dims = 2, init = 0f0)
ERROR: GPUArrays.jl needs to know the neutral element for your operator `#19`.
Please pass it as an explicit argument to (if possible), or register it
globally your operator by defining `GPUArrays.neutral_element(::typeof(#19), T)`.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] neutral_element(op::Function, T::Type)
@ GPUArrays ~\.julia\packages\GPUArrays\bjw3g\src\host\mapreduce.jl:13
[3] _accumulate!
@ ~\.julia\packages\CUDA\qEV3Y\src\accumulate.jl:205 [inlined]
[4] #accumulate!#738
@ .\accumulate.jl:361 [inlined]
[5] accumulate(op::Function, A::CuArray{Float32, 2}; dims::Int64, kw::Base.Iterators.Pairs{Symbol, Float32, Tuple{Symbol}, NamedTuple{(:init,), Tuple{Float32}}})
@ Base .\accumulate.jl:302
[6] top-level scope
@ REPL[24]:1
First I thought the error was asking for a init
value, which I provided, but apparently that’s not it…
So, what’s a neutral element then ?