Skip to content

Commit

Permalink
Fixes bug with dimensions, hopefully doesn't break anything else
Browse files Browse the repository at this point in the history
  • Loading branch information
astralcai committed Apr 10, 2024
1 parent 79856ef commit a24b59a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pennylane/transforms/hamiltonian_expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ def grouping_processing_fn(res_groupings, coeff_groupings, batch_size, offset):
# pylint: disable=no-member
if isinstance(r_group, (tuple, list, qml.numpy.builtins.SequenceBox)):
r_group = qml.math.stack(r_group, axis=-1)
r_group = qml.math.transpose(r_group)
if qml.math.shape(r_group) == ():
r_group = qml.math.reshape(r_group, (1,))
if batch_size:
r_group = r_group.T

if len(c_group) == 1 and len(r_group) != 1:
dot_products.append(r_group * c_group)
Expand Down

0 comments on commit a24b59a

Please sign in to comment.