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
Batch support for deterministic image ops #15726
Conversation
/cc @martinwicke @jhseu I would still like to include support for the random flip ops as well, but I'll do that in another PR if this looks acceptable. |
@martinwicke could you take a look, please? |
Nagging Assignee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
I'm sorry this took me so long. Could you fix the conflicts? I think it's just that proper name_scopes were added to all functions in this module, which is nice and should be easy to merge. |
if shape.ndims == 3 or shape.ndims is None: | ||
return _rot90_3D(image, k, scope) | ||
elif shape.ndims == 4: | ||
return _rot90_4D(image, k, scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing two methods for _rot90_3D
and _rot90_4D
is unfortunate. I'd definitely welcome a better suggestion. The other alternative was to stagger if shape.ndims == 3
checks throughout the method which didn't really help readability either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine.
@martinwicke I've merged the commits and I think I've done so properly. All the tests pass and there are still no performance regressions so it's probably ready for a code review. I also introduced |
Sanity complains about indentation:
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Sorry for the delay fixing indentation. I forgot to run the sanity checks locally. :( Thanks for taking care of it! |
Based on #14854 and working on #8926
Previously I had implemented batch support for a number of image ops. However performance concerns were raised and the changes were reverted.
I have re-implemented the changes for:
flip_left_right
flip_up_down
transpose_image
rot90
I ran performance tests from #15348 with:
bazel run -c opt //tensorflow/python:image_ops_test -- --benchmarks=FlipImageBenchmark
* There were no changes made to `RandomFlipLeftRight in this PR
Let me know if you would like me to add more performance tests for the other methods. I don't think there should be any performance impact, but I'm happy to add more if you'd like.