MCPcopy Create free account
hub / github.com/MegEngine/MegCC / render_init_body

Method render_init_body

compiler/lib/KernelGen/Utils/StringTemplate.cpp:106–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106const std::string StringTemplate::render_init_body(
107 uint32_t nr_out_weight, const std::string& fill_weight_attr,
108 const std::string& fill_weight_transform, const std::string& common_def) {
109 const std::string body_temp = R"({
110 if (out_weights == NULL && nr_out_weight != NULL) {
111 *nr_out_weight = ${nr_out_weight};
112 return TinyNN_SUCCESS;
113 }
114
115 ${common_def}
116
117 if (out_weights != NULL && nr_out_weight == NULL) {
118 ${fill_weight_attr}
119 return TinyNN_SUCCESS;
120 }
121 if (out_weights != NULL && nr_out_weight != NULL) {
122 ${fill_weight_transform}
123 }
124 return TinyNN_SUCCESS;
125}
126 )";
127 return StringTemplate::StringTemplateArgs()
128 .add("nr_out_weight", nr_out_weight)
129 .add("fill_weight_attr", fill_weight_attr)
130 .add("fill_weight_transform", fill_weight_transform)
131 .add("common_def", common_def)
132 .render(body_temp);
133}
134
135// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 3

StringTemplateArgsClass · 0.85
renderMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected