Open ctarn opened 1 year ago
This may need a bikeshed on the name...
Note also that "stack-like" seems misleading, in that this uses dims=ndims(x)
where stack
would use dims=ndims(x)+1
. It's along the last dimension, rather than always a new dimension.
julia> x4 = rand(3, 4, 5, 6);
julia> scat(x4, x4) |> size
(3, 4, 5, 12)
julia> stack((x4, x4)) |> size
(3, 4, 5, 6, 2)
Some names listed as below.
scat
: stack-like cattcat
: cat on the trunk dimensionlcat
: cat on leading/last dimensionmcat
: cat on major/main dimension, or merging catbcat
: cat as batchesccat
: cat as chunkspcat
: cat on the primary dimensionocat
: cat on the outermost dimension.Not recommended:
dcat
: the third dimension is commonly referred as depth
ncat
: (not recommended since the existing hvncat
)vcat
hcat
Hi, I would like to open the issue to see whether we are interested in specializing
cat
on the last dim.Currently, we have specialized
cat
on 1st and 2nd dim asvcat
andhcat
respectively, andreduce
onvcat
andhcat
have their own implementations for better performance.Additionally, we also have
stack
for similar purposes, butstack
requires that all items have the same size. (https://github.com/JuliaLang/julia/issues/21672, https://github.com/JuliaLang/julia/pull/43334)In my own code base, I call it
scat
(stack-like cat), and simply define it as below:An extra method for
reduce
for better performance is preferred: