Reputation: 1061
I have trouble finding the source code of torch.bmm()
, which is defined in https://pytorch.org/cppdocs/api/function_namespaceat_1aac51f71f807ca70fd210814114520c34.html#exhale-function-namespaceat-1aac51f71f807ca70fd210814114520c34.
I have confidence it is located in namespace at, since it is referenced as at::bmm in other places. What I have searched through is :
but have found nothing. Is there any systematic way to locate a function(in this case, bmm) in such a large project ?
Upvotes: 3
Views: 1888
Reputation: 17658
There is no (single) source for bmm
per se. From ATen's Readme:
ATen "native" functions are the modern mechanism for adding operators and functions to ATen (they are "native" in contrast to legacy functions, which are bound via TH/THC cwrap metadata). Native functions are declared in native_functions.yaml and have implementations defined in one of the cpp files in this directory.
bmm
is declared in aten\src\ATen\native\native_functions.yaml:
- func: bmm(Tensor self, Tensor mat2) -> Tensor
use_c10_dispatcher: full
variants: function, method
dispatch:
CPU: bmm_cpu
CUDA: bmm_cuda
SparseCPU: bmm_sparse_cpu
SparseCUDA: bmm_sparse_cuda
supports_named_tensor: True
The implementations (like bmm_cpu
) are to be found in aten\src\ATen\native\LinearAlgebra.cpp
.
Upvotes: 3