|
|
@@ -528,6 +528,16 @@ Status GeGenerator::GenerateModel(const Graph &graph, const string &file_name_pr |
|
|
return SUCCESS; |
|
|
return SUCCESS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
|
|
bool IsNeedConnectInputOpForSingleOp(GeTensorDesc &tesor_desc) { |
|
|
|
|
|
bool is_need = true; |
|
|
|
|
|
// format and dtype is all reserved, stand for Optional input. When singleop scene |
|
|
|
|
|
if (tensor_desc.GetFormat() == FORMAT_RESERVED && tensor_desc.GetDataType() == DT_UNDEFINED) { |
|
|
|
|
|
is_need = false; |
|
|
|
|
|
} |
|
|
|
|
|
return is_need; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &inputs, const vector<GeTensor> &outputs, |
|
|
Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &inputs, const vector<GeTensor> &outputs, |
|
|
const string &model_file_name, OpEngineType engine_type, ModelBufferData &model_buff, |
|
|
const string &model_file_name, OpEngineType engine_type, ModelBufferData &model_buff, |
|
|
bool is_offline) { |
|
|
bool is_offline) { |
|
|
@@ -575,12 +585,18 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &in |
|
|
if (inputs.empty()) { |
|
|
if (inputs.empty()) { |
|
|
for (const auto &input_desc : op_desc->GetAllInputsDescPtr()) { |
|
|
for (const auto &input_desc : op_desc->GetAllInputsDescPtr()) { |
|
|
GE_CHECK_NOTNULL_EXEC(input_desc, return INTERNAL_ERROR); |
|
|
GE_CHECK_NOTNULL_EXEC(input_desc, return INTERNAL_ERROR); |
|
|
|
|
|
if (!IsNeedConnectInputOpForSingleOp(*input_desc)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
GE_CHK_STATUS_RET_NOLOG(AddInputs(compute_graph, op_node, *input_desc, arg_index, false)); |
|
|
GE_CHK_STATUS_RET_NOLOG(AddInputs(compute_graph, op_node, *input_desc, arg_index, false)); |
|
|
arg_index++; |
|
|
arg_index++; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
for (const auto &in_desc : inputs) { |
|
|
for (const auto &in_desc : inputs) { |
|
|
GeTensorDesc input_desc = in_desc.GetTensorDesc(); |
|
|
GeTensorDesc input_desc = in_desc.GetTensorDesc(); |
|
|
|
|
|
if (!IsNeedConnectInputOpForSingleOp(input_desc)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
GE_CHK_STATUS_RET_NOLOG(AddInputs(compute_graph, op_node, input_desc, arg_index, true)); |
|
|
GE_CHK_STATUS_RET_NOLOG(AddInputs(compute_graph, op_node, input_desc, arg_index, true)); |
|
|
arg_index++; |
|
|
arg_index++; |
|
|
} |
|
|
} |
|
|
|