We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there,
It seems that tensorcontract, with its current definition, is type unstable:
julia> @code_warntype tensorcontract(A, a_idx, B, b_idx) Variables #self#::Core.Compiler.Const(TensorOperations.tensorcontract, false) A::Array{Int64,2} IA::Tuple{Int64,Int64} B::Array{Int64,2} IB::Tuple{Int64,Int64} Body::Array 1 ─ %1 = TensorOperations.symdiff(IA, IB)::Array{Int64,1} │ %2 = (#self#)(A, IA, B, IB, %1)::Array └── return %2
However, changing the definition (tested below) results in stability:
julia> mytensorcontract(A, IA, B, IB, IC = Tuple(symdiff(IA, IB))) = tensorcontract(A, tuple(IA...), B, tuple(IB...), IC) julia> @code_warntype mytensorcontract(A, a_idx, B, b_idx) Variables #self#::Core.Compiler.Const(mytensorcontract, false) A::Array{Int64,2} IA::Tuple{Int64,Int64} B::Array{Int64,2} IB::Tuple{Int64,Int64} Body::Union{} 1 ─ %1 = Main.symdiff(IA, IB)::Array{Int64,1} │ %2 = Main.tuple(%1)::Tuple{Array{Int64,1}} │ (#self#)(A, IA, B, IB, %2) └── Core.Compiler.Const(:(return %3), false)
I have made the change locally and all tests pass.
Is there any reason to use the current definition over the proposed one? I guess there is still an issue with passing an array explicitly:
c_idx::Array{Int} = ... @code_warntype mytensorcontract(A, a_idx, B, b_idx, c_idx) #-> not stable @code_warntype mytensorcontract(A, a_idx, B, b_idx, Tuple(c_idx)) #-> stable
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi there,
It seems that tensorcontract, with its current definition, is type unstable:
However, changing the definition (tested below) results in stability:
I have made the change locally and all tests pass.
Is there any reason to use the current definition over the proposed one? I guess there is still an issue with passing an array explicitly:
The text was updated successfully, but these errors were encountered: