Replace print(hist) with hist.numpy() to avoid print call, also avoid pylint too long (80) error
Remove extra "```" as doctest use ">>>" and "..." instead, and fix pylint issue by shorten the output Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
58a378f9f6
commit
c7ae49c070
@ -62,15 +62,14 @@ def histogram_fixed_width_bins(values,
|
||||
|
||||
Examples:
|
||||
|
||||
```python
|
||||
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
||||
...
|
||||
...
|
||||
>>> nbins = 5
|
||||
>>> value_range = [0.0, 5.0]
|
||||
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
||||
>>> tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
|
||||
<tf.Tensor: shape=(6,), dtype=int32, numpy=array([0, 0, 1, 2, 4, 4], dtype=int32)>
|
||||
```
|
||||
>>> indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
|
||||
>>> indices.numpy()
|
||||
array([0, 0, 1, 2, 4, 4], dtype=int32)
|
||||
"""
|
||||
with ops.name_scope(name, 'histogram_fixed_width_bins',
|
||||
[values, value_range, nbins]):
|
||||
@ -129,15 +128,14 @@ def histogram_fixed_width(values,
|
||||
|
||||
Examples:
|
||||
|
||||
```python
|
||||
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
||||
...
|
||||
...
|
||||
>>> nbins = 5
|
||||
>>> value_range = [0.0, 5.0]
|
||||
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
||||
>>> tf.histogram_fixed_width(new_values, value_range, nbins=5)
|
||||
<tf.Tensor: shape=(5,), dtype=int32, numpy=array([2, 1, 1, 0, 2], dtype=int32)>
|
||||
```
|
||||
>>> hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
|
||||
>>> hist.numpy()
|
||||
array([2, 1, 1, 0, 2], dtype=int32)
|
||||
"""
|
||||
with ops.name_scope(name, 'histogram_fixed_width',
|
||||
[values, value_range, nbins]) as name:
|
||||
|
Loading…
Reference in New Issue
Block a user