histogram(input: Tensor, bins: int | Sequence[float] = 10, range: tuple[float, float] | None = None, density: bool = False, weight: Tensor | None = None)Implementing kernel
C++ engine symbols that back this Python API.Compute a 1-D histogram of input values.
Parameters
inputTensorValues to bin. Flattened internally — shape doesn't matter.
binsint or sequence of float= 10When an int, the number of equal-width bins (default
10).
When a sequence, the explicit bin edges (length bins_n + 1).rangetuple[float, float]= None(lo, hi). Values outside the range are dropped. Ignored
when bins is a sequence of explicit edges. None
(default) → (input.min(), input.max()).densitybool= FalseWhen
True divide by total count × bin width to yield a
probability density that integrates to 1. Default False.Same length as
input. When supplied, sums weights per bin
rather than counting. Default None.Returns
tuple of Tensor(hist, bin_edges). hist is a 1-D count/density tensor;
bin_edges is 1-D of length bins + 1.