Skip to content

Commit fe3a4bc

Browse files
committed
Update tf.histogram_fixed_width docstring to comform to Python doctest
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
1 parent a610493 commit fe3a4bc

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

‎tensorflow/python/ops/histogram_ops.py‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ def histogram_fixed_width_bins(values,
6363
Examples:
6464
6565
```python
66-
# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
67-
nbins = 5
68-
value_range = [0.0, 5.0]
69-
new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
70-
71-
indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
72-
indices # [0, 0, 1, 2, 4, 4]
66+
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
67+
...
68+
>>> nbins = 5
69+
>>> value_range = [0.0, 5.0]
70+
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
71+
>>> indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
72+
>>> print(indices)
73+
tf.Tensor([0 0 1 2 4 4], shape=(6,), dtype=int32)
7374
```
7475
"""
7576
with ops.name_scope(name, 'histogram_fixed_width_bins',
@@ -130,13 +131,14 @@ def histogram_fixed_width(values,
130131
Examples:
131132
132133
```python
133-
# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
134-
nbins = 5
135-
value_range = [0.0, 5.0]
136-
new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
137-
138-
hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
139-
hist # [2, 1, 1, 0, 2]
134+
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
135+
...
136+
>>> nbins = 5
137+
>>> value_range = [0.0, 5.0]
138+
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
139+
>>> hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
140+
>>> print(hist)
141+
tf.Tensor([2 1 1 0 2], shape=(5,), dtype=int32)
140142
```
141143
"""
142144
with ops.name_scope(name, 'histogram_fixed_width',

0 commit comments

Comments
 (0)