-
Notifications
You must be signed in to change notification settings - Fork 55
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
Unintuitive ncon
result when scalar
#152
Comments
While it doesn't make a big difference, it is technically a breaking change. Other than that, I have no strong feelings. I thought that at least knowing that the return type is always some type of array or tensor more generally is somewhat consistent, but the compiler is inferring |
My main argument would be that julia> using TensorOperations
julia> A = rand(2,2);
julia> ncon([A, A], [[1, 2], [1, 2]])
0-dimensional Array{Float64, 0}:
1.60394
julia> @tensor A[1 2] * A[1 2]
1.60394 As a side-note, in principle we could make this "type-stable" by promoting the |
Fixed since 0390086 |
Noted by @leburgel:
When contracting a network that results in a scalar, currently
ncon
does not insert a final call totensorscalar
. As such the following (unintuitive) behaviour is happening:It is probably easier to just catch this and wrap the result in
tensorscalar
, asncon
is inherently type-unstable anyways, this should not make a huge difference.The text was updated successfully, but these errors were encountered: