tf.keras.ops.histogram
Stay organized with collections
Save and categorize content based on your preferences.
Computes a histogram of the data tensor x.
tf.keras.ops.histogram(
x, bins=10, range=None
)
Args |
x
|
Input tensor.
|
bins
|
An integer representing the number of histogram bins.
Defaults to 10.
|
range
|
A tuple representing the lower and upper range of the bins.
If not specified, it will use the min and max of x.
|
Returns |
A tuple containing:
- A tensor representing the counts of elements in each bin.
- A tensor representing the bin edges.
|
Example:
input_tensor = np.random.rand(8)
keras.ops.histogram(input_tensor)
(array([1, 1, 1, 0, 0, 1, 2, 1, 0, 1], dtype=int32),
array([0.0189519 , 0.10294958, 0.18694726, 0.27094494, 0.35494262,
0.43894029, 0.52293797, 0.60693565, 0.69093333, 0.77493101,
0.85892869]))
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 2026-10-31 UTC.
[null,null,["Last updated 2026-10-31 UTC."],[],[]]