类型信息¶
的数值属性torch.dtype可以通过torch.finfo或torch.iinfo.
torch.finfo¶
-
类
torch.finfo¶
一个torch.finfo是表示浮点数值属性的对象torch.dtype, (即 , , 和 )。这类似于 numpy.finfo。torch.float32torch.float64torch.float16
一个torch.finfo提供以下属性:
名字 |
类型 |
描述 |
|---|---|---|
位 |
int |
类型占用的位数。 |
每股收益 |
浮 |
最小的可表示数,使得 。 |
麦克斯 |
浮 |
最大可表示的数字。 |
分钟 |
浮 |
最小的可表示数字(通常为 )。 |
小 |
浮 |
最小的正法态数。见注释。 |
分辨率 |
浮 |
这种类型的近似十进制分辨率,即 . |
注意
的构造函数torch.finfo可以在没有参数的情况下调用,在这种情况下,将为 PyTorch 默认 dtype 创建类(由torch.get_default_dtype()).
注意
tiny 返回最小的正常数,但存在较小的 次正规数。有关更多信息,请参阅 https://en.wikipedia.org/wiki/Denormal_number。
Torch.iinfo¶
-
类
torch.iinfo¶
一个torch.iinfo是表示整数的数值属性的对象torch.dtype(即 、 和 )。这类似于 numpy.iinfo。torch.uint8torch.int8torch.int16torch.int32torch.int64
一个torch.iinfo提供以下属性:
名字 |
类型 |
描述 |
|---|---|---|
位 |
int |
类型占用的位数。 |
麦克斯 |
int |
最大可表示的数字。 |
分钟 |
int |
最小的可表示数字。 |