build/aten/src/ATen/UfuncCPU_add.cpp
After macro expansion and get
void structured_ufunc_add_CPU::impl(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, const at::Tensor & out) {
add_stub(device_type(), *this, alpha);
}
I can not understand the value add_stub()
here, because of ()operator overloading
in DispatchStub class, here add_stub can call following function, why does operator overloading have a return value but add_stub does’t have?
rT operator()(c10::DeviceType device_type, ArgTypes&&... args) {
FnPtr call_ptr = get_call_ptr(device_type);
return (*call_ptr)(std::forward<ArgTypes>(args)...);
}