Skip to content

Fix double bracket indexing bug on Hermes noise model - #786

Open
atvasilopoulos wants to merge 1 commit into
IBM:masterfrom
atvasilopoulos:hermes_model_indexing_bug
Open

Fix double bracket indexing bug on Hermes noise model#786
atvasilopoulos wants to merge 1 commit into
IBM:masterfrom
atvasilopoulos:hermes_model_indexing_bug

Conversation

@atvasilopoulos

Copy link
Copy Markdown
Collaborator

Description

Double brackets were used to index a torch tensor in the hermes noise model, leading to a UserWarning when using it. Fixed this by changing it to proper indexing.

Details

The following warning was raised when using the hermes noise model (model.program_analog_weights()).

UserWarning: Using a non-tuple sequence for multidimensional indexing is deprecated and will be changed in pytorch 2.9; use x[tuple(seq)] instead of x[seq]. In pytorch 2.9 this will be interpreted as tensor index, x[torch.tensor(seq)], which will result either in an error or a different result (Triggered internally at /__w/pytorch/pytorch/torch/csrc/autograd/python_variable_indexing.cpp:349.)
  g_relative[[g_relative >= 0.0945]],

Found 5 instances where this indexing pattern was used in the class. Single bracket solves the issue.

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