| 106 | } |
| 107 | |
| 108 | bool GraphExecutor::SetExecParam(Graph* graph) |
| 109 | { |
| 110 | #if 0 |
| 111 | int model_format = graph->GetModelFormat(); |
| 112 | |
| 113 | /* set proper layout */ |
| 114 | if(model_format == MODEL_FORMAT_CAFFE || model_format == MODEL_FORMAT_ONNX || |
| 115 | model_format == MODEL_FORMAT_TENSORFLOW || model_format == MODEL_FORMAT_MXNET || |
| 116 | model_format == MODEL_FORMAT_TENGINE) |
| 117 | { |
| 118 | exec_attr_.graph_layout = TENGINE_LAYOUT_NCHW; |
| 119 | |
| 120 | if(model_format == MODEL_FORMAT_TENSORFLOW) |
| 121 | exec_attr_.model_layout = TENGINE_LAYOUT_NHWC; |
| 122 | else |
| 123 | exec_attr_.model_layout = TENGINE_LAYOUT_NCHW; |
| 124 | } |
| 125 | else if(model_format == MODEL_FORMAT_TFLITE) |
| 126 | { |
| 127 | exec_attr_.graph_layout = TENGINE_LAYOUT_NHWC; |
| 128 | exec_attr_.model_layout = TENGINE_LAYOUT_NHWC; |
| 129 | } |
| 130 | else |
| 131 | { |
| 132 | XLOG_INFO() << "unkown model format: " << model_format << " to set layout \n"; |
| 133 | return false; |
| 134 | } |
| 135 | |
| 136 | exec_attr_.model_format = model_format; |
| 137 | #else |
| 138 | |
| 139 | #endif |
| 140 | |
| 141 | exec_attr_.graph_layout = graph->GetLayout(); |
| 142 | exec_attr_.model_layout = graph->GetModelLayout(); |
| 143 | exec_attr_.model_format = graph->GetModelFormat(); |
| 144 | |
| 145 | if(exec_attr_.graph_layout < 0) |
| 146 | { |
| 147 | LOG_ERROR() << "why graph layout is: " << exec_attr_.graph_layout << "\n"; |
| 148 | } |
| 149 | |
| 150 | if(exec_attr_.model_layout < 0) |
| 151 | { |
| 152 | LOG_ERROR() << "why model layout is: " << exec_attr_.model_layout << "\n"; |
| 153 | } |
| 154 | |
| 155 | if(exec_attr_.model_format < 0) |
| 156 | { |
| 157 | LOG_ERROR() << "why model format is: " << exec_attr_.model_format << "\n"; |
| 158 | } |
| 159 | |
| 160 | // check graph layout variable |
| 161 | const char* layout_str = std::getenv("GRAPH_LAYOUT"); |
| 162 | if(layout_str) |
| 163 | { |
| 164 | int layout = strtoul(layout_str, NULL, 10); |
| 165 |
nothing calls this directly
no test coverage detected