-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting type stability with EinCode #97
Comments
If you comment out the last line of I think the work here is ultimately done by julia> function f4(M, V; dim)
IA = (-1,0)
IB = ntuple(d -> d==dim ? 0 : d, ndims(V))
# IC = (-1, filter(!=(dim), ntuple(+, ndims(V)))...)
IC = ntuple(d -> d==dim ? -1 : d, ndims(V))
TensorOperations.tensorcontract(M, IA, V, IB, IC)
end
f4 (generic function with 1 method)
julia> f4(M, V; dim=2) ≈ f(M, V, dim=2)
true
julia> @code_warntype f4(M, V; dim=2)
...
Body::Array{Float64,3} |
I'm surprised to find out that even when the dimensions are known, it still returns unstable results:
It returns Any. Why would this be? |
Thank for the issue. Type stability is completely out of consideration in OMEinsum. High order tensors appears in many applications:
|
I have a function that computes the product of a square matrix along one dimension of an n-dimensional array. Thus, the returned array is of the same size as the passed array. Because the dimension over which to multiply is only known at runtime, I use
EinCode
. However, the result is not type-stable. Is there a good way to give OMEinsum more information so the compiler can figure out the return type? Or maybe more generally, what's the best way to contract over a single index shared by two arrays, where the index is only known at runtime?The text was updated successfully, but these errors were encountered: