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 tf.repeat support equivalent to numpy.repeat #26517
Conversation
687a6b7
to
bce9658
Compare
I would not be the right reviewer for this. |
@seanpmorgan I think this belongs in addons for now. WDYT? |
Initial Thoughts:
|
@seanpmorgan should this be tfa.manip.repeat so it can conceivably end up in tf.manip.repeat? |
+1, good job!
Yes, we need to create a new sub-package if we think addons should accept the contribution. But I'm not sure if it's appropriate to put primitive ops in addons, because the requirements in https://github.com/tensorflow/addons are:
@karmel @dynamicwebpaige What do you think? |
Yeah, my high level thought is that Apologies for the tepid answer, but obviously Addons will be in a forever battle with scope creep. |
Maybe tf-text? I agree that it's not obvious that this fits inside the addons paradigm. Although, if it were an op for repeating with a python endpoint rather than python for the same, I guess that would be allowed. |
@yongtang gentle ping to check review comments. |
@yongtang could you please rebase? |
(Most of the credit goes to RaggedTensor author, couldn't find the GitHub handle but the related commit is bad5d1a) This PR tries to address the issue raised in 8246 to have tf.repeat equivalent to numpy.repeat. Multiple attempts have been made in the past. My previous PR 15224 add the support with C++ which was closed, as a python implementation relying on existing ops is more desireable. This PR - moves the repeat implementation in ragged_util.py to array_ops.py so that it is possible to get exposed. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
to comform to numpy.repeat Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
… test cases Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
and update api golden Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
…review feedback Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
9ef37f8
to
6b1652e
Compare
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Merged internally , waiting for auto merge to happen. |
PiperOrigin-RevId: 264268362
Can one of the admins verify this patch? |
Looks like the PR has been merged into master so I will close this PR. Thanks everyone for the help to make this happen 👍 ❤️ 🎉 ! |
(Most of the credit goes to RaggedTensor author, couldn't find the GitHub handle but the related commit is bad5d1a)
This PR tries to address the issue raised in #8246 to have tf.repeat equivalent to numpy.repeat.
Multiple attempts have been made in the past. The previous PR #15224 add the support with C++ which was closed, as a python implementation relying on existing ops is more desirable.
Now repeat has been added in ragged_util.py for RaggedTensor (the axis=None is not covered but this is fairly straight ward). The related commit is bad5d1a.
This PR
tf.repeat
in v1 and v2.This fix fixes #8264.
Signed-off-by: Yong Tang yong.tang.github@outlook.com