optional_data Class — pytorch Architecture
Architecture documentation for the optional_data class in LossNLL.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/LossNLL.cpp lines 152–159
template <typename scalar_t>
inline scalar_t* optional_data(const Tensor& source) {
if constexpr (std::is_const_v<scalar_t>) {
return source.defined() ? source.const_data_ptr<scalar_t>() : nullptr;
} else {
return source.defined() ? source.data_ptr<scalar_t>() : nullptr;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free