Splatting specific dimension of multidimensional array?

Suppose, I have a multidimensional array. Can I somehow splat over a specific dimension?
An example scenario would be the following:

arr = randn(2,2,3)
kron(arr...)  # I would like to splat over the last dimension

However, here the splatting is performed regardless of the dimensions of the array and so the input is an NTuple of numbers.
Is there any way to do this without resorting to converting to a one-dimensional array of matrices?

Actually, I figured it out myself.
One way to do it is through array slicing by using eachslice. In the above example, one could do

kron(eachslice(arr, dims=3)...)

I don’t know about the efficiency of this though.

1 Like

Using reduce should be better:

reduce(kron, eachslice(arr, dims=3))