Merge pull request #38958 from yongtang:histogram-doc
PiperOrigin-RevId: 313240146 Change-Id: I7baa94b94466583d119f74dc3a6f2b540aebe4f0
This commit is contained in:
commit
e76bff1201
@ -64,17 +64,14 @@ def histogram_fixed_width_bins(values,
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```python
|
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
||||||
# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
...
|
||||||
nbins = 5
|
>>> nbins = 5
|
||||||
value_range = [0.0, 5.0]
|
>>> value_range = [0.0, 5.0]
|
||||||
new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
||||||
|
>>> indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
|
||||||
with tf.compat.v1.get_default_session() as sess:
|
>>> indices.numpy()
|
||||||
indices = tf.histogram_fixed_width_bins(new_values, value_range, nbins=5)
|
array([0, 0, 1, 2, 4, 4], dtype=int32)
|
||||||
variables.global_variables_initializer().run()
|
|
||||||
sess.run(indices) # [0, 0, 1, 2, 4, 4]
|
|
||||||
```
|
|
||||||
"""
|
"""
|
||||||
with ops.name_scope(name, 'histogram_fixed_width_bins',
|
with ops.name_scope(name, 'histogram_fixed_width_bins',
|
||||||
[values, value_range, nbins]):
|
[values, value_range, nbins]):
|
||||||
@ -134,17 +131,14 @@ def histogram_fixed_width(values,
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
```python
|
>>> # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
||||||
# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)
|
...
|
||||||
nbins = 5
|
>>> nbins = 5
|
||||||
value_range = [0.0, 5.0]
|
>>> value_range = [0.0, 5.0]
|
||||||
new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
>>> new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]
|
||||||
|
>>> hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
|
||||||
with tf.compat.v1.get_default_session() as sess:
|
>>> hist.numpy()
|
||||||
hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
|
array([2, 1, 1, 0, 2], dtype=int32)
|
||||||
variables.global_variables_initializer().run()
|
|
||||||
sess.run(hist) => [2, 1, 1, 0, 2]
|
|
||||||
```
|
|
||||||
"""
|
"""
|
||||||
with ops.name_scope(name, 'histogram_fixed_width',
|
with ops.name_scope(name, 'histogram_fixed_width',
|
||||||
[values, value_range, nbins]) as name:
|
[values, value_range, nbins]) as name:
|
||||||
|
Loading…
Reference in New Issue
Block a user