W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
原文:PyTorch 類型信息
可以通過 torch.finfo
或 torch.iinfo
訪問 torch.dtype
的數(shù)值屬性。
class torch.finfo?
torch.finfo
是表示浮點(diǎn) torch.dtype
(即torch.float32
,torch.float64
和torch.float16
)的數(shù)值屬性的對象。 這類似于 numpy.finfo 。
torch.finfo
提供以下屬性:
|
名稱
|
類型
|
描述
| | --- | --- | --- | | 位 | 整型 | 類型占用的位數(shù)。 | | eps | 浮動(dòng) | 最小可表示數(shù)字,例如1.0 + eps != 1.0
。 | | 最大值 | float | 可表示的最大數(shù)字。 | | 分 | float | 最小的可表示數(shù)字(通常為-max
)。 | | 小 | float | 可表示的最小正數(shù)。 |
注意
可以不帶參數(shù)地調(diào)用 torch.finfo
的構(gòu)造函數(shù),在這種情況下,將為 pytorch 默認(rèn) dtype 創(chuàng)建類(由 torch.get_default_dtype()
返回)。
class torch.iinfo?
torch.iinfo
是代表整數(shù) torch.dtype
(即torch.uint8
,torch.int8
,torch.int16
,torch.int32
和torch.int64
)。 這類似于 numpy.iinfo 。
torch.iinfo
提供以下屬性:
|
Name
|
Type
|
Description
| | --- | --- | --- | | bits | int | The number of bits occupied by the type. | | max | int | The largest representable number. | | min | int | 可表示的最小數(shù)字。 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: