mindspore.ops.Histogram

class mindspore.ops.Histogram(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 and higher than max are ignored.

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

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

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

Inputs:
  • x (Tensor) - the input tensor, type support list [float16, float32, int32]

Outputs:

Tensor, 1-D Tensor with type int32.

Raises
Supported Platforms:

CPU

Examples

>>> x = Tensor([1., 2, 1])
>>> op = ops.Histogram(bins=4, min=0.0, max=3.0)
>>> y = op(x)
>>> print(y)
[0 2 1 0]