Home / Class/ optional_data Class — pytorch Architecture

optional_data Class — pytorch Architecture

Architecture documentation for the optional_data class in LossNLL2d.cpp from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/LossNLL2d.cpp lines 36–43

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;
  }
}

Analyze Your Own Codebase

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

Try Supermodel Free