Anakin icon indicating copy to clipboard operation
Anakin copied to clipboard

Help!! Crash in Net init.

Open Alan-Turing-Ko opened this issue 6 years ago • 1 comments

Thanks for the great library. I want to run mobilenet (in benchmark example) on ARM in jni and model was converted successfully. I follow the arm inference example classification.cpp. Model loaded successfully and graph.get_outs() returns OK. But when call Net<ARM, AK_FLOAT, Precision::FP32, OpRunType::SYNC> net_executer(graph, ctx1, true); app crashes. Crash context is following module in net.cpp.

template<typename Ttype, DataType Dtype, Precision Ptype, OpRunType RunType> void Net<Ttype, Dtype, Ptype, RunType>::init(graph::Graph<Ttype, Dtype, Ptype>& graph,
OpContextPtr<Ttype> ctx) {

init_env(graph);
// shallow copy
_graph_p->CopyFrom(graph);
auto node_names_in_exec_order = graph.get_nodes_in_order();
// infer basic shape and parsing parameter from graph
for (auto& node_name : node_names_in_exec_order) {
    auto node_ptr = (*_graph_p)[node_name];
    //LOG(ERROR) << "get node " << node_name << ", op type " << node_ptr->get_op_name();
    if (node_ptr->get_op_name() == "Output") {
        continue;
    }

    // create operations
    auto* op_pointer = OpFactory<Ttype, Dtype, Ptype>::Global()[node_ptr->get_op_name()]; // Crash

node_ptr->get_op_name() is "Input". Global().get_list_op_name() returns empty list.

What can be the issue? Hope to any suggestions.

Alan-Turing-Ko avatar Jul 09 '18 09:07 Alan-Turing-Ko

if you linked static lib in your project, please add "-Wl,--whole-archive ${anakin_lib_static} -Wl,--no-whole-archive" in "target_link_libraries" in your CMakeList

xyoungli avatar Jul 12 '18 03:07 xyoungli