check_dynamic_cast Class — pytorch Architecture
Architecture documentation for the check_dynamic_cast class in Loops.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/cpu/Loops.h lines 341–355
template <bool check_dynamic_cast=true, typename func_t, typename vec_func_t>
void cpu_kernel_vec(TensorIteratorBase& iter, func_t&& op, vec_func_t&& vop, int64_t grain_size = at::internal::GRAIN_SIZE) {
using traits = function_traits<func_t>;
// this could be extended to work with void return types
TORCH_INTERNAL_ASSERT(iter.ninputs() == traits::arity);
TORCH_INTERNAL_ASSERT(iter.noutputs() == 1);
// dynamic casting not currently supported on CPU, but some kernels (like Fill)
// explicitly dynamic_cast, so we give the opt-out of checking.
if constexpr (check_dynamic_cast) {
TORCH_INTERNAL_ASSERT(!needs_dynamic_casting<func_t>::check(iter));
}
iter.for_each(make_vectorized_loop2d(std::forward<func_t>(op), std::forward<vec_func_t>(vop)), grain_size);
iter.cast_outputs();
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free