torch.histogram
function histogram(input: Tensor): HistogramResultfunction histogram(input: Tensor, bins: number | Tensor, range: [number, number], weight: Tensor | null, density: boolean, options: HistogramOptions): HistogramResultComputes the histogram of a tensor with bin edges.
Parameters
inputTensor- Input tensor
Returns
HistogramResult– Object with hist (counts) and bin_edges tensorsExamples
const x = torch.tensor([0.5, 1.5, 2.5, 3.5, 4.5]);
const { hist, bin_edges } = torch.histogram(x, 5);