tf.raw_ops.HistogramFixedWidth
Stay organized with collections
Save and categorize content based on your preferences.
Return histogram of values.
tf.raw_ops.HistogramFixedWidth(
values,
value_range,
nbins,
dtype=tf.dtypes.int32
,
name=None
)
Given the tensor values
, this operation returns a rank 1 histogram counting
the number of entries in values
that fall into every bin. The bins are
equal width and determined by the arguments value_range
and nbins
.
# 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]
with tf.get_default_session() as sess:
hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
variables.global_variables_initializer().run()
sess.run(hist) => [2, 1, 1, 0, 2]
Args |
values
|
A Tensor . Must be one of the following types: int32 , int64 , float32 , float64 .
Numeric Tensor .
|
value_range
|
A Tensor . Must have the same type as values .
Shape [2] Tensor of same dtype as values .
values <= value_range[0] will be mapped to hist[0],
values >= value_range[1] will be mapped to hist[-1].
|
nbins
|
A Tensor of type int32 .
Scalar int32 Tensor . Number of histogram bins.
|
dtype
|
An optional tf.DType from: tf.int32, tf.int64 . Defaults to tf.int32 .
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor of type dtype .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.HistogramFixedWidth\n\n\u003cbr /\u003e\n\nReturn histogram of values.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.HistogramFixedWidth`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/HistogramFixedWidth)\n\n\u003cbr /\u003e\n\n tf.raw_ops.HistogramFixedWidth(\n values,\n value_range,\n nbins,\n dtype=../../tf/dtypes#int32,\n name=None\n )\n\nGiven the tensor `values`, this operation returns a rank 1 histogram counting\nthe number of entries in `values` that fall into every bin. The bins are\nequal width and determined by the arguments `value_range` and `nbins`. \n\n # Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf)\n nbins = 5\n value_range = [0.0, 5.0]\n new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15]\n\n with tf.get_default_session() as sess:\n hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)\n variables.global_variables_initializer().run()\n sess.run(hist) =\u003e [2, 1, 1, 0, 2]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `values` | A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. Numeric `Tensor`. |\n| `value_range` | A `Tensor`. Must have the same type as `values`. Shape \\[2\\] `Tensor` of same `dtype` as `values`. values \\\u003c= value_range\\[0\\] will be mapped to hist\\[0\\], values \\\u003e= value_range\\[1\\] will be mapped to hist\\[-1\\]. |\n| `nbins` | A `Tensor` of type `int32`. Scalar `int32 Tensor`. Number of histogram bins. |\n| `dtype` | An optional [`tf.DType`](../../tf/dtypes/DType) from: `tf.int32, tf.int64`. Defaults to [`tf.int32`](../../tf#int32). |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `dtype`. ||\n\n\u003cbr /\u003e"]]