Pytorch Source Code
init
处理逻辑
- 判断当前运行环境,加载必须库文件
- Define basFic utilities 定义基本工具
typename
;is_tensor
; ... - Define numeric constants 定义数值常量
e
;inf
;nan
;pi
- Define Storage and Tensor classes 定义 Storage 和 Tensor 类
ctypes 库
- 一个可以在 python 中调用由 C、C++编写并导出的 dll 动态链接库的包
ctypes.CDLL('vcruntime140.dll')
加载使用 C、C++编写的vcruntime140.dll
文件
.pyi 文件
- python 中的类型提示文件,也被叫做存根文件 stub file
- 用于提供代码的静态类型信息,也可以用来表示公共的接口
- .pyi 文件给出变量或函数的静态类型,实现了 python 和 C、C++的绑定
参考
Pytorch Source Code