fix contract_ind passing inplace kwarg to cotengra#361
Open
JiwaniZakir wants to merge 1 commit into
Open
Conversation
Strip `inplace` from contract_opts in `TensorNetwork.contract_ind` before passing to `tensor_contract`, preventing a TypeError in cotengra's `_build_expression` which does not accept that keyword argument.
Owner
|
Hi @JiwaniZakir, I'm afraid this it not a suitable fix. Supplying By the way, is this an AI generated fix? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TensorNetwork.contract_indaccepted**contract_optsand forwarded them directly totensor_contract, causing aninplacekwarg to reach cotengra's_build_expression, which does not accept it and raises aTypeError. The fix adds a singlecontract_opts.pop("inplace", None)line at the top ofcontract_indbefore the opts are passed down. To verify, calltn.contract_ind(ind, inplace=False)on any two-tensor network sharing an index and confirm noTypeErroris raised; the new testtest_contract_ind_with_inplace_kwargcovers this case.Fixes #303