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 examples to tf.clip_by_value #29774
Conversation
tensorflow/python/ops/clip_ops.py
Outdated
For example: | ||
|
||
```python | ||
A=tf.constant([[1,20,13],[3,21,13]]) |
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.
Can the code be updated to be compatible with TF style? This means space around = used for assignment, space after commas, etc
tensorflow/python/ops/clip_ops.py
Outdated
A=tf.constant([[1,20,13],[3,21,13]]) | ||
B=tf.clip_by_value(A, clip_value_min=0, clip_value_max=3) #[[1, 3, 3],[3, 3, 3]] | ||
C=tf.clip_by_value(A, clip_value_min=0., clip_value_max=3.) | ||
# throws `TypeError` as input and clip_values are of different dtype |
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.
The comment on a different line is not obvious; either put it before or just elide this altogether
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.
Thanks @alextp. Updated according to your suggestion.
tensorflow/python/ops/clip_ops.py
Outdated
B=tf.clip_by_value(A, clip_value_min=0, clip_value_max=3) #[[1, 3, 3],[3, 3, 3]] | ||
C=tf.clip_by_value(A, clip_value_min=0., clip_value_max=3.) | ||
# throws `TypeError` as input and clip_values are of different dtype | ||
D=tf.constant([2.0,3.1,5.3]) |
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 don't know what value this third example is adding
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.
Removed third example. Thanks!
@jvishnuvardhan Can you please check Ubuntu Sanity errors? Thanks! |
Updated to clear sanity checks
…tch-8 PiperOrigin-RevId: 254979441
No description provided.