教育部开展青少年校园足球教练员国家级专项培训

paddle. histogram ( input: Tensor, bins: int = 100, min: float = 0.0, max: float = 0.0, weight: Tensor | None = None, density: bool = False, name: str | None = None ) Tensor [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.

Parameters
  • input (Tensor) – A Tensor with shape \([N_1, N_2,..., N_k]\) . The data type of the input Tensor should be float32, float64, int32, int64.

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

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

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

  • weight (Tensor, optional) – If provided, it must have the same shape as input. Each value in input contributes its associated weight towards the bin count (instead of 1). Default: None.

  • density (bool, optional) – If False, the result will contain the count (or total weight) in each bin. If True, the result is the value of the probability density function over the bins, normalized such that the integral over the range of the bins is 1.

  • name (str|None, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

Tensor, shape is (nbins,), the counts or density of the histogram.

Examples

>>> import paddle

>>> inputs = paddle.to_tensor([1, 2, 1])
>>> result = paddle.histogram(inputs, bins=4, min=0, max=3)
>>> print(result)
Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
[0, 2, 1, 0])