You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve support for Torch and Jax with dynamic_one_shot (#5672)
**Context:**
Opened in favour of #5630. Bug fix for #5442. This PR updates
`dynamic_one_shot` so that it has better compatibility with the `torch`
and `jax` interfaces.
**Description of the Change:**
* Change casting method from `array.astype()` to `qml.math.cast` in the
`apply_operation` dispatch for `MidMeasureMP`.
* Update usage of `qml.math` in `dynamic_one_shot`.
* When using `qml.counts`, cast results to ints before converting to
strings for lists of MCM values and floats for single MCM values. This
is needed because jax arrays are not hashable, and the hash of torch
tensors seems to be independent of the value(s) stored inside it. Thus,
neither can be used as keys for dictionaries.
**Benefits:**
Better interface support with `dynamic_one_shot`.
**Possible Drawbacks:**
**Related GitHub Issues:**
---------
Co-authored-by: Vincent Michaud-Rioux <vincent.michaud-rioux@xanadu.ai>
Co-authored-by: Vincent Michaud-Rioux <vincentm@nanoacademic.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
Co-authored-by: Korbinian Kottmann <43949391+Qottmann@users.noreply.github.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com>
Co-authored-by: Isaac De Vlugt <isaacdevlugt@gmail.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: trbromley <brotho02@gmail.com>
Co-authored-by: erick-xanadu <110487834+erick-xanadu@users.noreply.github.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
0 commit comments