# 类型信息 > 原文:[`pytorch.org/docs/stable/type_info.html`](https://pytorch.org/docs/stable/type_info.html) `torch.dtype`的数字属性可以通过`torch.finfo`或`torch.iinfo`来访问。 ## torch.finfo ```py class torch.finfo¶ ``` `torch.finfo`是一个表示浮点数`torch.dtype`(即`torch.float32`、`torch.float64`、`torch.float16`和`torch.bfloat16`)的数字属性的对象。这类似于[numpy.finfo](https://docs.scipy.org/doc/numpy/reference/generated/numpy.finfo.html)。 `torch.finfo`提供以下属性: | 名称 | 类型 | 描述 | | --- | --- | --- | | bits | int | 类型占用的位数。 | | eps | float | 可表示的最小数,使得`1.0 + eps != 1.0`。 | | max | float | 可表示的最大数。 | | min | float | 可表示的最小数(通常为`-max`)。 | | tiny | float | 最小的正常数。等同于`smallest_normal`。 | | smallest_normal | float | 最小的正常数。请参阅注释。 | | resolution | float | 此类型的近似十进制分辨率,即`10**-precision`。 | 注意 可以在不带参数的情况下调用`torch.finfo`的构造函数,此时类将为 pytorch 默认 dtype 创建(由`torch.get_default_dtype()`返回)。 注意 smallest_normal 返回最小的*正常*数,但存在更小的次正常数。有关更多信息,请参阅[`en.wikipedia.org/wiki/Denormal_number`](https://en.wikipedia.org/wiki/Denormal_number)。## torch.iinfo ```py class torch.iinfo¶ ``` `torch.iinfo`是一个表示整数`torch.dtype`(即`torch.uint8`、`torch.int8`、`torch.int16`、`torch.int32`和`torch.int64`)的数字属性的对象。这类似于[numpy.iinfo](https://docs.scipy.org/doc/numpy/reference/generated/numpy.iinfo.html)。 `torch.iinfo`提供以下属性: | 名称 | 类型 | 描述 | | --- | --- | --- | | bits | int | 类型占用的位数。 | | max | int | 可表示的最大数。 | | min | int | 可表示的最小数。 |