tf.histogram_fixed_width
Stay organized with collections Save and categorize content based on your preferences.
Return histogram of values.
tf.histogram_fixed_width(
values,
value_range,
nbins=100,
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 fell into every bin. The bins are equal width and determined by the arguments value_range
and nbins
.
Args |
---|
values | Numeric Tensor . |
value_range | 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 | Scalar int32 Tensor . Number of histogram bins. |
dtype | dtype for returned histogram. |
name | A name for this operation (defaults to 'histogram_fixed_width'). |
Returns |
---|
A 1-D Tensor holding histogram of values. |
Examples:
# 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]
hist = tf.histogram_fixed_width(new_values, value_range, nbins=5)
hist.numpy()
array([2, 1, 1, 0, 2], dtype=int32)
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]