torch.histc¶
- torch.histc(input, bins=100, min=0, max=0, *, out=None) Tensor ¶
计算张量的直方图。
元素被分到
min
和max
之间的等宽 bin 中。如果min
和max
都为零,则使用数据的最小值和最大值。小于 min、大于 max 的元素以及
NaN
元素会被忽略。- 参数
- 关键字参数
out (Tensor, optional) – 输出张量。
- 返回值
表示为张量的直方图
- 返回类型
示例
>>> torch.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3) tensor([ 0., 2., 1., 0.])