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

Add scan op #19681

Merged
merged 7 commits into from
May 8, 2024
Merged

Add scan op #19681

merged 7 commits into from
May 8, 2024

Conversation

james77777778
Copy link
Contributor

@james77777778 james77777778 commented May 7, 2024

Related to #19519

Originally, tf.scan stacks the output of the f as the final output and doesn't support the separated carry throughout the loop iterations.
I've reimplemented scan for tensorflow backend to align with the behavior of jax.lax.scan.

However, the current implementation requires that the output (y) of f must have the same shape/dtype as carry. This is not required in other backends.

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2024

Codecov Report

Attention: Patch coverage is 96.62162% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 78.49%. Comparing base (10c27c0) to head (fbab23e).

Files Patch % Lines
keras/src/backend/tensorflow/core.py 92.30% 2 Missing and 2 partials ⚠️
keras/api/_tf_keras/keras/ops/__init__.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19681      +/-   ##
==========================================
+ Coverage   78.42%   78.49%   +0.07%     
==========================================
  Files         498      498              
  Lines       45551    45699     +148     
  Branches     8394     8448      +54     
==========================================
+ Hits        35723    35872     +149     
+ Misses       8094     8093       -1     
  Partials     1734     1734              
Flag Coverage Δ
keras 78.34% <96.62%> (+0.07%) ⬆️
keras-jax 61.94% <19.59%> (-0.13%) ⬇️
keras-numpy 56.30% <39.86%> (-0.05%) ⬇️
keras-tensorflow 63.38% <48.64%> (-0.05%) ⬇️
keras-torch 62.01% <39.18%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM -- great job!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels May 8, 2024
@fchollet fchollet merged commit 43e5155 into keras-team:master May 8, 2024
9 checks passed
@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label May 8, 2024
@james77777778 james77777778 deleted the add-scan branch May 9, 2024 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

5 participants