torchtyping:PyTorch张量的形状,dtype等的运行时类型注释

时间:2024-04-27 15:48:53
【文件属性】:

文件名称:torchtyping:PyTorch张量的形状,dtype等的运行时类型注释

文件大小:24KB

文件格式:ZIP

更新时间:2024-04-27 15:48:53

Python

火炬打字 输入张量的形状,dtype,名称,...的注释 转这个: def batch_outer_product ( x : torch . Tensor , y : torch . Tensor ) -> torch . Tensor : # x has shape (batch, x_channels) # y has shape (batch, y_channels) # return has shape (batch, x_channels, y_channels) return x . unsqueeze ( - 1 ) * y . unsqueeze ( - 2 ) 到这个: def batch_outer_product ( x : TensorType [ "batch" , "x_channels" ],


【文件预览】:
torchtyping-master
----pyproject.toml(301B)
----test()
--------test_misc.py(4KB)
--------test_consistency.py(3KB)
--------test_details.py(8KB)
--------test_shape.py(5KB)
--------test_examples.py(6KB)
--------conftest.py(131B)
--------test_ellipsis.py(5KB)
--------test_extensions.py(1KB)
--------test_dtype_layout.py(1KB)
----torchtyping()
--------tensor_details.py(5KB)
--------utils.py(659B)
--------__init__.py(231B)
--------tensor_type.py(5KB)
--------typechecker.py(16KB)
--------pytest_plugin.py(378B)
----setup.py(2KB)
----.gitignore(129B)
----FURTHER-DOCUMENTATION.md(8KB)
----README.md(7KB)
----.flake8(90B)

网友评论