value Class — pytorch Architecture
Architecture documentation for the value class in boxing.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/boxing/impl/boxing.h lines 234–262
template <class Result, class... Args>
struct BoxedKernelWrapper<
Result(Args...),
std::enable_if_t<
can_box_all<Args...>::value && can_unbox<Result>::value &&
!is_tuple_of_mutable_tensor_refs<Result>::value,
void>> {
static Result call(
const BoxedKernel& boxed_kernel_func,
const OperatorHandle& opHandle,
DispatchKeySet dispatchKeySet,
Args... args) {
torch::jit::Stack stack = boxArgs<Args...>(std::forward<Args>(args)...);
boxed_kernel_func.callBoxed(opHandle, dispatchKeySet, &stack);
if constexpr (!std::is_same_v<void, Result>) {
// op has pushed one or more values onto the stack.
return PopResult<Result>::call(stack);
} else {
// op returns void, boxed kernel has pushed nothing onto stack.
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
stack.empty(),
"Boxed kernel was expected to return no values on the stack, ",
"but instead returned ",
stack.size(),
" values.");
}
}
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free