is_same_v Class — pytorch Architecture
Architecture documentation for the is_same_v class in make_boxed_from_unboxed_functor.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h lines 543–580
template <class KernelFunctor, class ReturnType, class... ParameterTypes>
struct wrap_kernel_functor_unboxed_<
KernelFunctor,
ReturnType(ParameterTypes...)>
final {
static_assert(
std::is_same_v<
ReturnType,
typename guts::infer_function_traits_t<KernelFunctor>::return_type>,
"Return type mismatch");
static_assert(
std::is_same_v<
guts::typelist::typelist<ParameterTypes...>,
typename guts::infer_function_traits_t<
KernelFunctor>::parameter_types>,
"Parameter types mismatch");
// See [Note: Argument forwarding in the dispatcher] for why ParameterTypes
// doesn't use &&
static ReturnType call(
OperatorKernel* functor,
DispatchKeySet /*unused*/,
ParameterTypes... args) {
KernelFunctor* functor_ = static_cast<KernelFunctor*>(functor);
// Note [Plumbing Keys Through The Dispatcher 2]
// See Note [Plumbing Keys Through The Dispatcher] for the background.
// This functor explicitly takes in a dispatchKeySet and drops it on the
// floor- it does not forward it to the registered kernel.
//
// This is due to the calling convention within the dispatcher, which
// expects all registered kernels to have a first argument of type
// DispatchKeySet.
// This is not the case for pretty much all manually written kernels,
// however- this functor serves to separate the calling convention of the
// dispatcher from the calling convention of manually written kernels.
return (*functor_)(std::forward<ParameterTypes>(args)...);
}
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free