| 267 | /* ===================== ExternCOprRunner ===================== */ |
| 268 | MGB_DYN_TYPE_OBJ_FINAL_IMPL(ExternCOprRunner); |
| 269 | ExternCOprRunner::ExternCOprRunner( |
| 270 | std::string& name, const VarNodeArray& inputs, std::shared_ptr<MGBOprDesc> desc, |
| 271 | const OperatorNodeConfig& config) |
| 272 | : Super{inputs[0]->owner_graph(), config, desc->type_name, inputs}, |
| 273 | m_desc{std::move(desc)}, |
| 274 | m_dump_name{name}, |
| 275 | m_param{nullptr} { |
| 276 | auto size_diff = sizeof(MGBOprDesc) - m_desc->size; |
| 277 | is_loader_support_dynamic_param = (0 == size_diff) ? true : false; |
| 278 | mgb_assert( |
| 279 | 0 == size_diff || sizeof(ExternCOprParam*) == size_diff, |
| 280 | "invalid OprDesc size: expect=%zu got=%u, may caused by " |
| 281 | "extern_c_opr.h mismatch, please confirm that the " |
| 282 | "extern_c_opr.h used when compiling the loader is consistent " |
| 283 | "with the runtime caller build used", |
| 284 | sizeof(MGBOprDesc), m_desc->size); |
| 285 | for (auto i : inputs) { |
| 286 | add_input({i}); |
| 287 | } |
| 288 | auto nr_out = m_desc->nr_output; |
| 289 | if (nr_out > 1) { |
| 290 | for (size_t i = 0, it = nr_out; i < it; ++i) |
| 291 | add_output(ssprintf("o%zu", i)); |
| 292 | } else { |
| 293 | mgb_assert( |
| 294 | nr_out == 1, "could not create an operator with %u outputs: %s", nr_out, |
| 295 | cname()); |
| 296 | add_output(None); |
| 297 | } |
| 298 | add_equivalence_component<MGBOprDescHash>(m_desc.get()); |
| 299 | } |
| 300 | |
| 301 | void ExternCOprRunner::get_output_var_shape( |
| 302 | const TensorShapeArray& inp_shape, TensorShapeArray& out_shape) const { |
nothing calls this directly
no test coverage detected