mindspore.ops.histc

mindspore.ops.histc(input, bins=100, min=0.0, max=0.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, type support list \([float16, float32, int32]\).

  • bins (int, optional) – Number of histogram bins, optional. If specified, must be positive. Default: 100 .

  • min (int, float, optional) – An optional float of the lower end of the range (inclusive). Default: 0.0 .

  • max (int, float, optional) – An optional float of the upper end of the range (inclusive). Default: 0.0 .

Returns

Tensor, 1-D Tensor with type int32.

Raises
Supported Platforms:

Ascend CPU

Examples

>>> from mindspore import Tensor, ops
>>> x = Tensor([1., 2, 1])
>>> y = ops.histc(x, bins=4, min=0.0, max=3.0)
>>> print(y)
[0 2 1 0]