Skip to content

Reject quadratic biases for unknown edges - #82

Open
danielgaskins wants to merge 1 commit into
dwavesystems:mainfrom
danielgaskins:fix/unknown-quadratic-edge
Open

Reject quadratic biases for unknown edges#82
danielgaskins wants to merge 1 commit into
dwavesystems:mainfrom
danielgaskins:fix/unknown-quadratic-edge

Conversation

@danielgaskins

Copy link
Copy Markdown

While looking at #19, I noticed that set_quadratic leaves the edge index as None when neither orientation exists in the model. PyTorch treats parameter[None] as an extra dimension, so assigning the requested bias broadcasts it across every quadratic weight instead of rejecting the input.

Raise a ValueError before the assignment. The existing test happened to use a nonexistent edge and only checked the first overwritten bias, so update it to use an actual reversed edge and add a regression test confirming that an unknown edge leaves every bias unchanged.

Tests:

  • python3 -m unittest discover -s tests -v
  • reno lint
  • python3 -m compileall -q dwave tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant