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

Added usage examples to some APIs #35388

Merged

Conversation

msteknoadam
Copy link
Contributor

Added usage examples to these APIs

  • image.random_flip_up_down
  • image.flip_up_down
  • image.random_flip_left_right
  • image.flip_left_right
  • image.transpose
  • image.random_brightness
  • image.random_contrast
  • image.random_hue
  • image.random_jpeg_quality
  • image.random_saturation

-- Re-Opened the PR since the last one wasn't based off the master --

msteknoadam and others added 5 commits December 24, 2019 20:04
Added to:
- image.random_flip_up_down
- image.flip_up_down
- image.random_flip_left_right
- image.flip_left_right
Added usage examples to these APIs aswell:
- image.transpose
- image.random_brightness
- image.random_contrast
- image.random_hue
- image.random_jpeg_quality
- image.random_saturation
Co-Authored-By: Kilaru Yasaswi Sri Chandra Gandhi <yasaswisrichandragandhi@gmail.com>
@tensorflow-bot tensorflow-bot bot added the size:M CL Change Size: Medium label Dec 24, 2019
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-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 by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@msteknoadam
Copy link
Contributor Author

@googlebot I consent.

@kyscg
Copy link
Contributor

kyscg commented Dec 25, 2019

@googlebot I consent

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@ravikyram ravikyram self-assigned this Dec 26, 2019
@ravikyram ravikyram added the comp:ops OPs related issues label Dec 26, 2019
@msteknoadam
Copy link
Contributor Author

Yeah actually that idea feels good, I will do it ASAP. Thanks for the recommendation!

@mihaimaruseac
Copy link
Collaborator

Thanks for the update. However, it still fails to be testable.

I was thinking of something more on the lines of

>>> t = [[1, 2, 3],
... [4, 5, 6]]
>>> tf.reshape(t, [3, 2]).numpy()
array([[1, 2],
[3, 4],
[5, 6]], dtype=int32)
>>> tf.transpose(t, perm=[1, 0]).numpy()
array([[1, 4],
[2, 5],
[3, 6]], dtype=int32)

@msteknoadam
Copy link
Contributor Author

Hmm yeah, ok. I will be changing them in a few mins.

@msteknoadam
Copy link
Contributor Author

Ok, made the changes. Can you check again?

@mihaimaruseac
Copy link
Collaborator

Looks better but still not there:

  • Don't use tf.random.normal as then testing would depend on the seed that is being used. Instead, explicitly use some values (like in the example above, t = [[1, 2, 3],...)
  • Use >>> instead of >> as >>> signal that this is documentation test which will then be tested.
  • There is no need for the triple backquote markers and the python tagging. The >>> makes this look like properly-formatted code in the documentation.
  • Don't insert these examples after the typing/argument documentation, but before that. Args:/Returns:/etc. are expected to always be the last blocks in a docstring.

tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
tensorflow/python/ops/image_ops_impl.py Outdated Show resolved Hide resolved
@ravikyram ravikyram added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Jan 6, 2020
@mihaimaruseac mihaimaruseac added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Jan 7, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jan 7, 2020
@mihaimaruseac
Copy link
Collaborator

I think you might need to rebase against master again

@msteknoadam
Copy link
Contributor Author

Sure thing, done!

@msteknoadam
Copy link
Contributor Author

By the way, I guess last error was a false-triggered error since it was giving 404 when reaching to logs and I have seen that when you re-ran it, it didn't give an error.

@mihaimaruseac mihaimaruseac removed the ready to pull PR ready for merge process label Jan 7, 2020
mihaimaruseac
mihaimaruseac previously approved these changes Jan 7, 2020
@tensorflow-bot tensorflow-bot bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jan 7, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jan 7, 2020
@rthadur
Copy link
Contributor

rthadur commented Jan 7, 2020

@msteknoadam can you please resolve conflicts

@tensorflow-bot tensorflow-bot bot added the kokoro:force-run Tests on submitted change label Jan 7, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jan 7, 2020
@rthadur rthadur added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Jan 7, 2020
tensorflow-copybara pushed a commit that referenced this pull request Jan 7, 2020
PiperOrigin-RevId: 288567304
Change-Id: I92da0849729e645ceab19a5791737ea20e3d7f12
@tensorflow-copybara tensorflow-copybara merged commit 24a3a51 into tensorflow:master Jan 7, 2020
@msteknoadam
Copy link
Contributor Author

Sorry, I was sleeping at the moment you requestef for changes but thanks for doing the changes for me. I'm very happy that this PR finally got merged :D Have a great day everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:ops OPs related issues ready to pull PR ready for merge process size:M CL Change Size: Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants