Home / Class/ call Class — pytorch Architecture

call Class — pytorch Architecture

Architecture documentation for the call class in KernelFunction_impl.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/core/boxing/KernelFunction_impl.h lines 141–186

template <class Return, class... Args>
C10_ALWAYS_INLINE Return KernelFunction::call(
    const OperatorHandle& opHandle,
    DispatchKeySet dispatchKeySet,
    Args... args) const {
  // note: Args above is intentionally not Args&&. We don't want perfect
  // forwarding, which would require Args to be deduced, but instead we
  // want callers to explicitly specify the Args.

  if constexpr (std::disjunction_v<has_symint<Args>...>) {
    if (sym_unboxed_kernel_func_ != nullptr) {
      auto* functor = boxed_kernel_func_.getFunctor();
      return callUnboxedKernelFunction<Return, Args...>(
          sym_unboxed_kernel_func_,
          functor,
          dispatchKeySet,
          std::forward<Args>(args)...);
    }

    if (unboxed_kernel_func_ != nullptr) {
      auto* functor = boxed_kernel_func_.getFunctor();
      return callUnboxedKernelFunction<
          Return,
          typename remove_symint<Args>::type...>(
          unboxed_kernel_func_,
          functor,
          dispatchKeySet,
          unpackSymInt<Args>(args)...);
    }
  } else {
    if (C10_LIKELY(unboxed_kernel_func_ != nullptr)) {
      auto* functor = boxed_kernel_func_.getFunctor();
      return callUnboxedKernelFunction<Return, Args...>(
          unboxed_kernel_func_,
          functor,
          dispatchKeySet,
          std::forward<Args>(args)...);
    }
  }

  return impl::BoxedKernelWrapper<Return(Args...)>::call(
      boxed_kernel_func_,
      opHandle,
      dispatchKeySet,
      std::forward<Args>(args)...);
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free