test Class — pytorch Architecture
Architecture documentation for the test class in op_registration_test.cpp from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/op_registration/op_registration_test.cpp lines 817–851
template<class InputType, class OutputType = InputType>
struct testArgTypes final {
template<class APIType = TestModernAndLegacyAPI>
static void test(InputType input, std::function<void(const InputType&)> inputExpectation, OutputType output, std::function<void(const IValue&)> outputExpectation, const std::string& schema) {
// Test with explicitly specified schema
ArgTypeTestKernel<InputType, OutputType>::test(
APIType(), input, inputExpectation, output, [&] (const c10::Stack& output) {
EXPECT_EQ(1, output.size());
outputExpectation(output[0]);
}, schema
);
// Test with inferred schema
ArgTypeTestKernel<InputType, OutputType>::test(
APIType(), input, inputExpectation, output, [&] (const c10::Stack& output) {
EXPECT_EQ(1, output.size());
outputExpectation(output[0]);
}, ""
);
// Test taking argument and returning nothing
ArgTypeTestKernel<InputType, std::tuple<>>::test(
APIType(), input, inputExpectation, {}, [] (const c10::Stack&) {}, ""
);
// Test taking argument and returning multiple outputs
ArgTypeTestKernel<InputType, std::tuple<int64_t, OutputType>>::test(
APIType(), input, inputExpectation, std::tuple<int64_t, OutputType>{3, output}, [&] (const c10::Stack& output) {
EXPECT_EQ(2, output.size());
EXPECT_EQ(3, output[0].toInt());
outputExpectation(output[1]);
}, ""
);
}
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free