Home / Class/ _expand_param_if_needed Class — pytorch Architecture

_expand_param_if_needed Class — pytorch Architecture

Architecture documentation for the _expand_param_if_needed class in ParamUtils.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/native/utils/ParamUtils.h lines 9–25

template <typename T>
inline std::vector<T> _expand_param_if_needed(
    ArrayRef<T> list_param,
    const char* param_name,
    int64_t expected_dim) {
  if (list_param.size() == 1) {
    return std::vector<T>(expected_dim, list_param[0]);
  } else if ((int64_t)list_param.size() != expected_dim) {
    std::ostringstream ss;
    ss << "expected " << param_name << " to be a single integer value or a "
       << "list of " << expected_dim << " values to match the convolution "
       << "dimensions, but got " << param_name << '=' << list_param;
    TORCH_CHECK(false, ss.str());
  } else {
    return list_param.vec();
  }
}

Analyze Your Own Codebase

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

Try Supermodel Free