1 Star 0 Fork 71

刘诺二 / pytorch-doc-zh

forked from OpenDocCN / pytorch-doc-zh 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
100.md 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
片刻小哥哥 提交于 2020-03-04 14:15 . 更新 1.4 翻译版本

类型信息

原文: https://pytorch.org/docs/stable/type_info.html

可以通过 torch.finfotorch.iinfo 访问 torch.dtype 的数值属性。

torch


class torch.finfo¶

torch.finfo 是表示浮点 torch.dtype (即torch.float32torch.float64torch.float16)的数值属性的对象。 这类似于 numpy.finfo

torch.finfo 提供以下属性:

|

名称

|

类型

|

描述

| | --- | --- | --- | | 位 | 整型 | 类型占用的位数。 | | eps | 浮动 | 最小可表示数字,例如1.0 + eps != 1.0。 | | 最大值 | float | 可表示的最大数字。 | | 分 | float | 最小的可表示数字(通常为-max)。 | | 小 | float | 可表示的最小正数。 |

注意

可以不带参数地调用 torch.finfo 的构造函数,在这种情况下,将为 pytorch 默认 dtype 创建类(由 torch.get_default_dtype() 返回)。

torch


class torch.iinfo¶

torch.iinfo 是代表整数 torch.dtype (即torch.uint8torch.int8torch.int16torch.int32torch.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 | 可表示的最小数字。 |

1
https://gitee.com/Andrew_Liu/pytorch-doc-zh.git
git@gitee.com:Andrew_Liu/pytorch-doc-zh.git
Andrew_Liu
pytorch-doc-zh
pytorch-doc-zh
master

搜索帮助