Skip to content

Generic reducedim #31427

@MikeInnes

Description

@MikeInnes
julia> add(a, b) = a+b
add (generic function with 1 method)

julia> reduce(add, rand(5,5), dims = (1, 2))
ERROR: MethodError: no method matching reducedim_init(::typeof(identity), ::typeof(add), ::Array{Float64,2}, ::Tuple{Int64,Int64})

It seems like Julia should just do something sensible and generic here, like map does already – is there a specific reason not too, or is it just unimplemented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]foldsum, maximum, reduce, foldl, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions