Home / Class/ AddMoments Class — pytorch Architecture

AddMoments Class — pytorch Architecture

Architecture documentation for the AddMoments class in moments_utils.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/cpu/moments_utils.h lines 20–34

template <typename T>
void AddMoments(
    int64_t m0_add,
    const T& m1_add,
    const T& m2_add,
    int64_t& m0,
    T& m1,
    T& m2) {
  const int64_t n = m0 + m0_add;
  const T c = n == 0 ? static_cast<T>(0) : static_cast<T>(m0_add) / static_cast<T>(n);
  const T delta = m1_add - m1;
  m1 += c * delta;
  m2 += m2_add + delta * delta * c * static_cast<T>(m0);
  m0 = n;
}

Analyze Your Own Codebase

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

Try Supermodel Free