Skip to content

Support reducing on multiple dims #53

@christiangnrd

Description

@christiangnrd

This is currently not supported. Ideally a AK.mapreducedim! would be used to support it which would make integrating this package in GPUArrays much simpler.

julia> import AcceleratedKernels as AK; a = ones(2,3,4);

julia> reduce(+, a; dims=[1,2], init=0)
1×1×4 Array{Int64, 3}:
[:, :, 1] =
 6

[:, :, 2] =
 6

[:, :, 3] =
 6

[:, :, 4] =
 6

julia> AK.reduce(+, a; dims=[1,2], init=0)
ERROR: TypeError: in keyword argument dims, expected Union{Nothing, Int64}, got a value of type Vector{Int64}
Stacktrace:
 [1] reduce(op::Function, src::Array{Float64, 3}, backend::KernelAbstractions.CPU; init::Int64, kwargs::@Kwargs{dims::Vector{Int64}})
   @ AcceleratedKernels ~/.julia/packages/AcceleratedKernels/xxjhi/src/reduce/reduce.jl:81
 [2] top-level scope
   @ REPL[6]:1
 [3] top-level scope
   @ ~/.julia/dev/Metal/src/initialization.jl:80

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions