PennyLaneAI / catalyst

A JIT compiler for hybrid quantum programs in PennyLane
https://docs.pennylane.ai/projects/catalyst
Apache License 2.0
122 stars 27 forks source link

Support for some non-boolean types as predicates of a conditional with Autograph #944

Closed rauletorresc closed 1 month ago

rauletorresc commented 1 month ago

Context: CondCallable class was assuming boolean values for its predicate, but other types can be passed as predicates as well.

Description of the Change: Convert the predicate into boolean at the constructor site.

Benefits: Predicate is in proper type.

Possible Drawbacks: Are there types that cannot be converted (correctly) to booleans?

Related GitHub Issues: https://github.com/PennyLaneAI/catalyst/issues/940

TODO:

closes #940

[sc-69070]

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.93%. Comparing base (70861a1) to head (dbe8230).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #944 +/- ## ======================================= Coverage 97.93% 97.93% ======================================= Files 72 72 Lines 10301 10317 +16 Branches 1172 1176 +4 ======================================= + Hits 10088 10104 +16 Misses 169 169 Partials 44 44 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.