Increase docstring consistency - #11932
Conversation
|
Can one of the admins verify this patch? |
66d44f6 to
6ed48b3
Compare
MarkDaoust
left a comment
There was a problem hiding this comment.
I like these changes. Making things more consistent, and making examples more directly runnable is very nice.
Most of my attached comments are just farther consistency improvements.
But please revert the two spots where you changed the code at the same time.
Thanks.
| Dimension(None).merge_with(Dimension(n)) == Dimension(n) | ||
| Dimension(None).merge_with(Dimension(None)) == Dimension(None) | ||
| Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m | ||
|
|
There was a problem hiding this comment.
These blocks don't seem to be pseudo-code.
These are referring to tf.Dimension
A better fix here (and in the rest of this file) might be :
tf.Dimension(n) .merge_with(tf.Dimension(m)) # raises ValueError for n != m
As you've done in the rest of this PR.
| def f3(): return tf.constant(-1) | ||
| r = tf.case({tf.less(x, y): f1, tf.greater(x, z): f2}, | ||
| default=f3, exclusive=True) | ||
| ``` |
There was a problem hiding this comment.
Someone else just submitted a patch to this section.
You need to resolve the conflict.
|
|
||
|
|
||
| def real(input, name=None): | ||
| def real(x, name=None): |
There was a problem hiding this comment.
Revert this.
We can't change the name of the argument here.
It will break any code that passes the arg by name.
tf.real(input=1.0+0.2j)
Either way, in a big docs formatting PR like this, no code should change.
|
|
||
|
|
||
| def imag(input, name=None): | ||
| def imag(x, name=None): |
| tf.accumulate_n([a, b, a], shape=[2, 2], tensor_dtype=tf.int32) | ||
| ==> [[7, 4], [6, 14]] | ||
| tf.accumulate_n([a, b, a], shape=[2, 2], tensor_dtype=tf.int32) # [[7, 4], | ||
| [6, 14]] |
There was a problem hiding this comment.
missing a # on the second line
| ``` | ||
| ```python | ||
| example_names: ["input0", "input1"], | ||
| features: { |
There was a problem hiding this comment.
I don't entirely understand this file, but this block is not valid python as is.
| ``` | ||
| ```python | ||
| x = ... # Tensor of shape [1, 2, 3, 4]. | ||
| rotate_transpose(x, -1) # result shape: [2, 3, 4, 1] |
There was a problem hiding this comment.
To make these more concrete this could be:
x = tf.random_normal([1,2,3,4])
Then add a .shape to each rotate_transpose(...)
This way the two == comparison examples work (== on tensors, I think, just checks identity so these currently return False. But rotate_transpose(x, 7).shape == rotate_transpose(x, 3).shape returns True)
(the result comments can also then be reduced to # [3, 4, 2, 1])
|
|
||
| ``` | ||
| ```python | ||
| >>> _unique_layer_name('dense') |
There was a problem hiding this comment.
In the rest of the examples we have no carets, and the result in an inline comment.
You could do the same thing here.
c5fbdb2 to
fb80f21
Compare
|
I agree with the feedback, thank you @MarkDaoust! I reflected all the comments. |
These comparison examples need parenthesis to work properly.
Set values to `start`, `limit`, and `delta`
|
I am happy with this. It will also fixes a bunch of inline examples that weren't rendering on the website. I've re-checked the PR. It is now a pure docs-only change. (It could have been a little easier to review the update if you had just added the commit instead of squashing them together.) Thanks! |
|
@tensorflow-jenkins test this please |
This PR considers the following six main items:
ReturnwithReturns(The frequencies over all python codes: 2 vs. 3369)ArgumentswithArgs(
Argsis a consistent word over all python codes excepttensorflow/contrib/kerasandtensorflow/python/layers)tensorflow/python/framework/tensor_shape.py, removing```for consistency on the filetensorflow/python/ops/array_ops.pyandmath_ops.py, revising python code blocks to make them more concrete==>with#because==>is not a python keyword.tf.) are mixed. I think it is better to make them astf.operationnotoperation.# 'x' is [1, 4]is replaced byx = tf.constant([1, 4]).)