| 104 | } |
| 105 | |
| 106 | const 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 |
nothing calls this directly
no test coverage detected