Skip to content

Commit

Permalink
use a standardized axes order for tensordot calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Nov 2, 2020
1 parent 5123a68 commit df7073c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opt_einsum/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,11 @@ def _core_contract(operands, contraction_list, backend='auto', evaluate_constant
left_pos.append(input_left.find(s))
right_pos.append(input_right.find(s))

# Contruct the axes tuples in a canonical order
axes = tuple(zip(*sorted(zip(left_pos, right_pos))))

# Contract!
new_view = _tensordot(*tmp_operands, axes=(tuple(left_pos), tuple(right_pos)), backend=backend)
new_view = _tensordot(*tmp_operands, axes=axes, backend=backend)

# Build a new view if needed
if (tensor_result != results_index) or handle_out:
Expand Down

0 comments on commit df7073c

Please sign in to comment.