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

Method call_method_with_args

paddle/phi/api/include/compat/torch/library.cpp:75–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75FunctionResult ClassRegistry::call_method_with_args(
76 const std::string& qualified_name,
77 const std::string& method_name,
78 const FunctionArgs& args) const {
79 auto it = classes_.find(qualified_name);
80 if (it == classes_.end()) {
81 PADDLE_THROW(common::errors::NotFound("Class %s not found in registry!",
82 qualified_name.c_str()));
83 }
84
85 auto& class_reg = it->second;
86 auto method_it = class_reg->methods.find(method_name);
87 if (method_it == class_reg->methods.end()) {
88 PADDLE_THROW(common::errors::NotFound("Method %s not found in class %s!",
89 method_name.c_str(),
90 qualified_name.c_str()));
91 }
92
93 try {
94 VLOG(3) << "Executing " << qualified_name << "::" << method_name
95 << " (instance) with " << args.size() << " args";
96 auto result = method_it->second->call_with_args(args);
97
98 if (result.has_value()) {
99 VLOG(3) << "Instance method executed successfully with return value";
100 } else {
101 VLOG(3) << "Instance method executed successfully (void)";
102 }
103 return result;
104 } catch (const std::exception& e) {
105 VLOG(3) << "Instance method execution failed: " << e.what();
106 throw;
107 }
108}
109
110FunctionResult ClassRegistry::call_method_with_args(
111 const std::string& qualified_name,

Callers 2

__getattr__Method · 0.80
TESTFunction · 0.80

Calls 9

c_strMethod · 0.80
call_with_argsMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
has_valueMethod · 0.45
whatMethod · 0.45
add_argMethod · 0.45
get_valueMethod · 0.45

Tested by 1

TESTFunction · 0.64