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
We should extend #21672
for all iterators, in so far as is possible.
That way people would not run into surprises
when they do reduce(hcat, filter(x->x[1]>5, xs))
or reduce(vcat, (vec(sum(abs2, xs; dim=2)) for x in xs) etc
Because right now the performance of those kind of things is worse than splatting.
and it is really annoying having to be so careful about your types when writing code.
Likely any PR to solve this would also solve #31169
just because that one makes writing tests for correctness of behavior annoying
Fixing this for generators
would allow solving the mapreduce(vcat/hcat problem in #31137
(and its generalization to nonarrays,)
since
we could have mapreduce(f, vcat, xs) = reduce(vcat, f(x) for x in xs)
The text was updated successfully, but these errors were encountered:
oxinabox
changed the title
Optimized reduce(vcat, xs) and reduce(hcat, xs) for nonarrays
Optimized reduce(vcat, xs) and reduce(hcat, xs) for xs being any iterator
Apr 7, 2019
Potentially, each wanting there own special treatment.
Since for example if you know the length for hcat of Vectors you know the width of the matrix you must allocate.
and any time you work with matrixes reshape tricks need to be played
We should extend #21672
for all iterators, in so far as is possible.
That way people would not run into surprises
when they do
reduce(hcat, filter(x->x[1]>5, xs))
or
reduce(vcat, (vec(sum(abs2, xs; dim=2)) for x in xs)
etcBecause right now the performance of those kind of things is worse than splatting.
and it is really annoying having to be so careful about your types when writing code.
Likely any PR to solve this would also solve #31169
just because that one makes writing tests for correctness of behavior annoying
Fixing this for generators
would allow solving the
mapreduce(vcat/hcat
problem in #31137(and its generalization to nonarrays,)
since
we could have
mapreduce(f, vcat, xs) = reduce(vcat, f(x) for x in xs)
The text was updated successfully, but these errors were encountered: