The tensor multiplication operator in arraymancer * seems to only support multiplying matrices (tensors of dimension 2).
Is there an equivalent of the implementation of dot() in numpy that supports higher dimension tensors and only multiplies the joint dimensions (typically last of first tensor and first of second tensor)?
I played around with einsum but I couldn't find a working ellipsis (as in numpy's implementation) to handle dimension independence, and it doesn't seem to support GPU acceleration.
As far as I'm aware, you're right. There is no generalized dot at this time.
I imagine it shouldn't be too hard to implement based on slicing the correct dimensions. Without a specific example it's a bit hard to reason about for me right now.
Regarding einsum: yup, there's also no ... there. Up to now I didn't even know about that functionality in numpy (I implemented the arraymancer einsum). And indeed, einsum is rather "dumb", i.e. it just generates the required loops.
If you have an explicit example, maybe I can help a bit better.
Here is an example.
import arraymancer
let
x = [[[1,2,3]]].toTensor()
y = [[1,2],[3,4],[5,6]].toTensor()
let c = einsum(x, y):
x[i,j,k] * y[k,l]
echo (x.shape, y.shape, c.shape)
The resulting shapes are: x: [1, 1, 3] y: [3, 2] c = x * y: [1, 1, 2]
The output shall contain [[[22, 28]]].
I'm not quite sure I understand you. In this example the actual output of the einsum is precisely what you say as "The output shall contain...".
Or is this an example of what you'd like to do with dot?