|
|
|
@ -226,7 +226,7 @@ class Impl {
|
|
|
|
|
~Impl() { (void)generator_.Finalize(); };
|
|
|
|
|
graphStatus CheckOptions(const std::map<std::string, std::string> &options);
|
|
|
|
|
graphStatus CreateInputsForIRBuild(const ge::Graph &graph, vector<ge::GeTensor> &inputs);
|
|
|
|
|
graphStatus GetDefaultInputShapeAndFormat(const Graph &graph, string &default_shape, string &input_format);
|
|
|
|
|
graphStatus GetDefaultInputShape(const Graph &graph, string &default_shape);
|
|
|
|
|
graphStatus Init(const Graph &graph, const std::map<std::string, std::string> &options);
|
|
|
|
|
graphStatus BuildModel(const Graph &graph, const std::map<std::string, std::string> &options,
|
|
|
|
|
ModelBufferData &ge_models);
|
|
|
|
@ -280,7 +280,7 @@ graphStatus Impl::CheckOptions(const std::map<std::string, std::string> &options
|
|
|
|
|
return GRAPH_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
graphStatus Impl::GetDefaultInputShapeAndFormat(const Graph &graph, string &default_shape, string &input_format) {
|
|
|
|
|
graphStatus Impl::GetDefaultInputShape(const Graph &graph, string &default_shape) {
|
|
|
|
|
auto compute_graph = ge::GraphUtils::GetComputeGraph(graph);
|
|
|
|
|
GE_CHECK_NOTNULL(compute_graph);
|
|
|
|
|
for (ge::NodePtr &input_node : compute_graph->GetDirectNode()) {
|
|
|
|
@ -308,14 +308,11 @@ graphStatus Impl::GetDefaultInputShapeAndFormat(const Graph &graph, string &defa
|
|
|
|
|
default_shape += tmp_shape_str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ge::Format data_format = tensor.GetFormat();
|
|
|
|
|
input_format.assign(ge::TypeUtils::FormatToSerialString(data_format));
|
|
|
|
|
GELOGD("Data op name: %s, data shape: %s, data format: %s.", data_op_name.c_str(), tmp_shape_str.c_str(),
|
|
|
|
|
input_format.c_str());
|
|
|
|
|
GELOGD("Data op name: %s, data shape: %s.", data_op_name.c_str(), tmp_shape_str.c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
default_shape = (default_shape.empty() ? default_shape : default_shape.substr(0, default_shape.size() - 1));
|
|
|
|
|
GELOGI("Get default data op shape: %s, format: %s from ge ir graph.", default_shape.c_str(), input_format.c_str());
|
|
|
|
|
GELOGI("Get default data op shape: %s from ge ir graph.", default_shape.c_str());
|
|
|
|
|
return GRAPH_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -338,14 +335,13 @@ graphStatus Impl::Init(const Graph &graph, const std::map<std::string, std::stri
|
|
|
|
|
options_[ge::ir_option::LOG_LEVEL] = log;
|
|
|
|
|
|
|
|
|
|
string input_shape;
|
|
|
|
|
string tmp_input_format;
|
|
|
|
|
if (options_.find("input_shape") == options_.end()) {
|
|
|
|
|
GE_CHK_BOOL_EXEC(GetDefaultInputShapeAndFormat(graph, input_shape, tmp_input_format) == ge::SUCCESS,
|
|
|
|
|
GE_CHK_BOOL_EXEC(GetDefaultInputShape(graph, input_shape) == ge::SUCCESS,
|
|
|
|
|
return ge::GRAPH_PARAM_INVALID, "Get default data op shape from graph failed!");
|
|
|
|
|
} else {
|
|
|
|
|
input_shape = options_["input_shape"];
|
|
|
|
|
}
|
|
|
|
|
string input_format = options_.find("input_format") == options_.end() ? tmp_input_format : options_["input_format"];
|
|
|
|
|
string input_format = options_.find("input_format") == options_.end() ? "" : options_["input_format"];
|
|
|
|
|
string net_format = options_.find("net_format") == options_.end() ? "" : options_["net_format"];
|
|
|
|
|
string dynamic_batch_size = options_.find(ge::ir_option::DYNAMIC_BATCH_SIZE) == options_.end()
|
|
|
|
|
? ""
|
|
|
|
|