MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / TEST

Function TEST

test/cpp/compat/torch_library_test.cc:139–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139TEST(test_torch_library, TestLibraryOperators) {
140 auto qualified_name = "example_library::mymuladd";
141 auto* op = torch::OperatorRegistry::instance().find_operator(qualified_name);
142 ASSERT_NE(op, nullptr);
143 auto impl_it = op->implementations.find(c10::DispatchKey::CPU);
144 ASSERT_NE(impl_it, op->implementations.end());
145 torch::FunctionArgs function_args;
146 function_args.add_arg(torch::IValue(at::ones({2, 2}, at::kFloat)));
147 function_args.add_arg(torch::IValue(at::ones({2, 2}, at::kFloat)));
148 function_args.add_arg(torch::IValue(2.0));
149 auto result = impl_it->second.call_with_args(function_args);
150 ASSERT_TRUE(result.get_value().is_tensor());
151 auto result_tensor = result.get_value().to_tensor();
152}
153
154TEST(test_torch_library, TestLibraryClasses) {
155 auto qualified_name = "example_library::TestClass";

Callers

nothing calls this directly

Calls 15

IValueClass · 0.85
FunctionArgsClass · 0.85
parseSchemaFunction · 0.85
CppFunctionClass · 0.85
make_optionalFunction · 0.85
find_operatorMethod · 0.80
call_with_argsMethod · 0.80
to_tensorMethod · 0.80
is_custom_classMethod · 0.80
call_method_with_argsMethod · 0.80

Tested by

no test coverage detected