-
Notifications
You must be signed in to change notification settings - Fork 74.2k
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
Documentation for tf.math.add_n #27293
Documentation for tf.math.add_n #27293
Conversation
please @dynamicwebpaige review this |
I have done the changes as asked by you. |
I still see the trailing whitespace line. Did you push the new commit? |
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/eager/backprop.py |
You can try running the following commands (make sure to copy them exactly, one by one):
|
@mihaimaruseac changed that white line trailing issue int his pr also. |
Now please somebody review |
Please somebody review this PR |
@mihaimaruseac please review |
Please review this PR |
@rthadur please assign a reviewer to this pr |
tensorflow/python/ops/math_ops.py
Outdated
a = tf.constant([[3, 5], [4, 8]]) | ||
b = tf.constant([[1, 6], [2, 9]]) | ||
tf.math.add_n([a, b, a]) # [[7, 16], [10, 25]] | ||
|
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.
Please remove this blank line and add one before Args:
.
tensorflow/python/ops/math_ops.py
Outdated
@@ -2786,7 +2786,17 @@ def add_n(inputs, name=None): | |||
"""Adds all input tensors element-wise. | |||
|
|||
Converts `IndexedSlices` objects into dense tensors prior to adding. | |||
|
|||
tf.math.add_n performs same operation as'tf.math.accumulate_n' but it waits |
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.
tf.math.add_n
should have ` around it (e.g. `tf.math.add_n`
). If you do that our doc generator will correctly add links between the pages.
Please also replace the single quotes around 'tf.math.accumulate_n'
with ` too.
Finally, grammar: "performs the same" (add "the").
@@ -2786,7 +2786,17 @@ def add_n(inputs, name=None): | |||
"""Adds all input tensors element-wise. | |||
|
|||
Converts `IndexedSlices` objects into dense tensors prior to 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.
Please add a newline after this sentence.
tensorflow/python/ops/math_ops.py
Outdated
|
||
tf.math.add_n performs same operation as'tf.math.accumulate_n' but it waits | ||
for all of its inputs to be ready before beginning to sum, that consumes more | ||
memory. |
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'd suggest adding more detail on why the mem usage is higher. For example:
This can increase memory if inputs are ready at different times, since minimum temporary storage is proportional to inputs size rather than the output size.
@tomhennigan done with the changes please review it now. |
please review @tomhennigan |
[[ 0 0 0 0] | ||
[ 0 0 128 63] | ||
[ 0 0 128 63]], shape=(3, 4), dtype=uint8) | ||
In case ofconverting from a real data type to complex data type(e.g. tf.complex64, |
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.
Please revert changes in this file, they are not related.
for all of its inputs to be ready before beginning to sum, that consumes more | ||
memory as inputs are not ready at different times, since minimum temporary storage | ||
is proportional to the output size rather than the inputs size. | ||
For example: |
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'd suggest putting a newline before "For example:" otherwise the documentation generator will put the "For example:" at the end of the previous sentence.
For reference you can use gist.github.com to see how your markdown will end up get rendered. Here is the current version: https://gist.github.com/tomhennigan/d2789426d38bdbd9471e7e00555eced0
tensorflow/python/ops/math_ops.py
Outdated
|
||
`tf.math.add_n` performs the same operation as `tf.math.accumulate_n` but it waits | ||
for all of its inputs to be ready before beginning to sum, that consumes more | ||
memory as inputs are not ready at different times, since minimum temporary storage |
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.
that consumes more memory as inputs are not ready at different times
I'm not sure this makes sense. How about "This can consume more memory when inputs are ready at different times, since the minimum temporary storage required is proportional to the input size rather than the output size."
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.
Basically, in tf.math.accumulate_n documentation anti of this is given as the reason for it to be better than tf.math.add_n, you can check there.So I just manipulated that statement so that why tf.math.add_n is less preferrable than accumulate_n.
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.
Ok still I am adding what you just said.
@tomhennigan please review it now |
Please review it @tomhennigan |
@rthadur please add kokoro force run |
@rthadur tests are still pending |
please somebody intialize checks |
@tomhennigan can you please tell me why it is failing ubuntu sanity check. |
@tomhennigan I think that error was because of longer length of lines so I reduced length of lines. |
Please keep |
@mihaimaruseac i made changes internally , please approve |
PiperOrigin-RevId: 241816639
Modified tf.math.add_n #25820 by adding example and linking it to tf.math.accumulate_n.