mindspore.ops.histc

View Source On Gitee
mindspore.ops.histc(input, bins=100, min=0., max=0.)[source]

Computes the histogram of a tensor.

The elements are sorted into equal width bins between min and max. If min and max are both zero, the minimum and maximum values of the data are used.

Elements lower than min or higher than max are ignored.

Parameters
  • input (Tensor) – The input tensor.

  • bins (int, optional) – Number of histogram bins. Default 100 .

  • min (int, float, optional) – Minimum value of the histogram data range. Default 0. .

  • max (int, float, optional) – Maximum value of the histogram data range. Default 0. .

Returns

Tensor

Supported Platforms:

Ascend CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([1., 1, 2, 2, 2, 5, 8])
>>> output = mindspore.ops.histc(input, bins=5, min=0, max=9)
>>> print(output)
[2. 3. 1. 0. 1.]