torch.histc¶
- torch.histc(input, bins=100, min=0, max=0, *, out=None) Tensor ¶
計算張量的直方圖。
元素會被分類到
min
和max
之間等寬的區間 (bins) 中。 如果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.])