PyTorch 将运算符映射到函数 [英] PyTorch mapping operators to functions
问题描述
PyTorch 的所有运算符是什么,它们的功能等价物是什么?
例如,a @ b
等价于 a.mm(b)
或 a.matmul(b)
吗?
我正在寻找运算符 -> 函数映射的规范列表.
我很高兴收到 PyTorch 文档链接作为答案 - 我的 googlefu 无法找到它.
Python 文档表 将运算符映射到函数 提供来自以下方面的规范映射:
运算符 -> __function__()
例如:
<块引用>矩阵乘法 a @ b matmul(a, b)
在页面的其他地方,您会看到 __matmul__
名称作为 matmul
的替代名称.
PyTorch __functions__
的定义位于:
您可以在以下位置查找命名函数的文档:
https://pytorch.org/docs/stable/torch.html?#torch.
What are all the PyTorch operators, and what are their function equivalents?
Eg, is a @ b
equivalent to a.mm(b)
or a.matmul(b)
?
I'm after a canonical listing of operator -> function mappings.
I'd be happy to be given a PyTorch documentation link as an answer - my googlefu couldn't track it down.
The Python documentation table Mapping Operators to Functions provides canonical mappings from:
operator -> __function__()
Eg:
Matrix Multiplication a @ b matmul(a, b)
Elsewhere on the page, you will see the __matmul__
name as an alternate to matmul
.
The definitions of the PyTorch __functions__
are found either in:
You can look up the documentation for the named functions at:
https://pytorch.org/docs/stable/torch.html?#torch.<FUNCTION-NAME>
这篇关于PyTorch 将运算符映射到函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!