-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Description
Currently this is a bit inconsistent:
julia> a = zeros(0,0)
0×0 Array{Float64,2}
julia> sum(a,dims=1)
1×0 Array{Float64,2}
julia> minimum(a,dims=1)
ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
[1] _empty_reduce_error() at ./reduce.jl:216
[2] reducedim_init(::Function, ::typeof(min), ::Array{Float64,2}, ::Int64) at ./reducedim.jl:135
[3] _mapreduce_dim at ./reducedim.jl:313 [inlined]
[4] #mapreduce#543 at ./reducedim.jl:304 [inlined]
[5] #mapreduce at ./none:0 [inlined]
[6] _minimum at ./reducedim.jl:675 [inlined]
[7] _minimum at ./reducedim.jl:674 [inlined]
[8] #minimum#551 at ./reducedim.jl:648 [inlined]
[9] (::getfield(Base, Symbol("#kw##minimum")))(::NamedTuple{(:dims,),Tuple{Int64}}, ::typeof(minimum), ::Array{Float64,2}) at ./none:0
[10] top-level scope at REPL[10]:1
Basically it comes down to whether or not Base.reduce_empty(op, eltype(a))
is defined. Is it possible to support this more generally?
Metadata
Metadata
Assignees
Labels
No labels