Home / Class/ checkArg Class — pytorch Architecture

checkArg Class — pytorch Architecture

Architecture documentation for the checkArg class in function_schema_inl.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/core/function_schema_inl.h lines 7–25

template<typename T>
inline void FunctionSchema::checkArg(
    const IValue& value,
    const Argument& argument,
    std::optional<size_t> pos) const {
  if (value.isTensor() && argument.type() == TensorType::get()) {
    // Fast-path for the common case
    return;
  }
  if (value.isGenericDict() && value.toGenericDict().empty()) {
    return;
  }
  if (!value.type<T>()->isSubtypeOf(*argument.type())) {
    TORCH_CHECK(
        false,
        formatTypeMismatchMsg(
            argument, value.type<T>()->repr_str(), pos));
  }
}

Analyze Your Own Codebase

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

Try Supermodel Free