tf.raw_ops.HistogramFixedWidth | TensorFlow v2.16.1 (original) (raw)
tf.raw_ops.HistogramFixedWidth
Stay organized with collections Save and categorize content based on your preferences.
Return histogram of values.
View aliases
Compat aliases for migration
SeeMigration guide for more details.
tf.compat.v1.raw_ops.HistogramFixedWidth
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. |