Skip to content

Revert "#6586 - Avoid DivisionByZero error when TensorNetwork simplifies to a scalar" #6958

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

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions cirq-core/cirq/contrib/quimb/state_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,8 @@ def tensor_expectation_value(
)
else:
tn.rank_simplify(inplace=True)
# TODO(#6586): revert when our minimum quimb version has bugfix for quimb#231
# Skip path-info evaluation when TensorNetwork consists of scalar Tensors.
# Avoid bug in quimb-1.8.0.
# Ref: https://github.com/jcmgray/quimb/issues/231
if tn.ind_map:
path_info = tn.contract(get='path-info')
ram_gb = path_info.largest_intermediate * 128 / 8 / 1024 / 1024 / 1024
else:
ram_gb = 0
path_info = tn.contract(get='path-info')
ram_gb = path_info.largest_intermediate * 128 / 8 / 1024 / 1024 / 1024
if ram_gb > max_ram_gb:
raise MemoryError(f"We estimate that this contraction will take too much RAM! {ram_gb} GB")
e_val = tn.contract(inplace=True)
Expand Down