Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Tensorflow type promotion error with Tensors #5155

Merged
merged 4 commits into from Feb 6, 2024
Merged

Conversation

astralcai
Copy link
Contributor

@astralcai astralcai commented Feb 5, 2024

Context:
default.mixed used with tensorflow throws an error when applying a state that is not initialized in complex128, originally found here: https://discuss.pennylane.ai/t/error-with-keraslayer-and-amplitude-embedding/3924

Description of the Change:
tf.convert_to_tensor does not work for states that are already Tensor objects with a different dtype. Use tf.cast instead when this is the case.

Benefits:
BugFix

Related GitHub Issues:
#5085

Shortcut
[sc-55061]

Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d5e3cca) 99.69% compared to head (24e71a8) 99.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5155      +/-   ##
==========================================
- Coverage   99.69%   99.68%   -0.01%     
==========================================
  Files         394      394              
  Lines       36118    35850     -268     
==========================================
- Hits        36007    35738     -269     
- Misses        111      112       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@astralcai astralcai marked this pull request as ready for review February 5, 2024 17:10
@astralcai astralcai requested a review from a team February 5, 2024 17:10
@astralcai astralcai enabled auto-merge (squash) February 6, 2024 13:53
@albi3ro albi3ro disabled auto-merge February 6, 2024 14:46
@albi3ro albi3ro merged commit 64fb2be into master Feb 6, 2024
33 checks passed
@albi3ro albi3ro deleted the tf-type-promo branch February 6, 2024 14:46
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.

None yet

4 participants