问题
I'm trying to find the source code for torch.mean and am unable to find it in the pytorch github. It is under math operations but I can't find it at all.
I've looked everywhere and inspected most pages under pytorch/torch and am still unable to find it.
I even did ?? in a jupyter notebook but it just returned a useless docstring
回答1:
Since operations components are written in C++, they are not callable with operations such as ?? or "__file__" or "getsourcefile" type of operations.
The files appear to be here, written in C++:
https://github.com/pytorch/pytorch/blob/master/caffe2/operators/mean_op.cc https://github.com/pytorch/pytorch/blob/master/caffe2/operators/mean_op.h
来源:https://stackoverflow.com/questions/58786133/the-location-of-source-code-for-torch-mean