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

Fix output shape of KerasLayer #1165

Merged
merged 3 commits into from
Mar 25, 2021
Merged

Fix output shape of KerasLayer #1165

merged 3 commits into from
Mar 25, 2021

Conversation

trbromley
Copy link
Contributor

Context:

A minor bug was introduced in #1070. Currently, the following gives a shape of <unknown>:

layer = KerasLayer(...)
inputs = tf.keras.Input(shape=(2,))
inputs_shape = inputs.shape

output_shape = layer.compute_output_shape(inputs_shape)
print(output_shape)

(Note that inputs_shape = (None, 2)).

The output shape should be (None, 1).

Description of the Change:

This PR ensures that the output shape is as expected, i.e., (None, 1). A supporting test is added.

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@trbromley
Copy link
Contributor Author

I haven't updated the changelog because it's a bug-fixed for an unreleased change.

@trbromley trbromley requested a review from josh146 March 25, 2021 14:37
@codecov
Copy link

codecov bot commented Mar 25, 2021

Codecov Report

Merging #1165 (f0007ed) into master (46d94db) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1165   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files         144      144           
  Lines       10775    10775           
=======================================
  Hits        10572    10572           
  Misses        203      203           
Impacted Files Coverage Δ
pennylane/qnn/keras.py 96.92% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46d94db...f0007ed. Read the comment docs.

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@trbromley trbromley merged commit 94e8098 into master Mar 25, 2021
@trbromley trbromley deleted the fix_keras_shape branch March 25, 2021 18:49
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.

2 participants