|
|
|
@ -63,6 +63,7 @@ void TransOpWithoutReshapeFusionPass::SetRemainNode(
|
|
|
|
|
if (op_desc == nullptr) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
GELOGI("SetRemainNode node is %s", op_desc->GetName().c_str());
|
|
|
|
|
GE_IF_BOOL_EXEC(!op_desc->SetExtAttr(kRemainNode, true), GELOGE(INTERNAL_ERROR, "set ext attr failed"); return );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -183,7 +184,7 @@ void TransOpWithoutReshapeFusionPass::GetOutDataPeerInControlAnchors(
|
|
|
|
|
void TransOpWithoutReshapeFusionPass::GetInControlPeerOutControlAnchors(
|
|
|
|
|
const size_t index, vector<vector<OutControlAnchorPtr>> &in_control_peer_out_control_anchors) {
|
|
|
|
|
// The caller guarantees that the index is legal.
|
|
|
|
|
for (size_t j = 1; j < sub_graph_nodes_[index].size(); ++j) {
|
|
|
|
|
for (size_t j = 1; j < (sub_graph_nodes_[index].size() - 1); ++j) {
|
|
|
|
|
auto node = sub_graph_nodes_[index][j];
|
|
|
|
|
GE_CHECK_NOTNULL_JUST_RETURN(node);
|
|
|
|
|
auto in_control_anchor = node->GetInControlAnchor();
|
|
|
|
@ -743,7 +744,7 @@ graphStatus TransOpWithoutReshapeFusionPass::Run(ComputeGraphPtr graph) {
|
|
|
|
|
if (IsTransOp(node)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
GELOGD("Current normal node name: %s, type: %s.", node->GetName().c_str(), node->GetType().c_str());
|
|
|
|
|
GELOGI("Current normal node name: %s, type: %s.", node->GetName().c_str(), node->GetType().c_str());
|
|
|
|
|
for (const auto &out_anchor : node->GetAllOutDataAnchors()) {
|
|
|
|
|
GE_CHECK_NOTNULL(out_anchor);
|
|
|
|
|
vector<vector<pair<OutDataAnchorPtr, InDataAnchorPtr>>> sub_graph_anchors;
|
|
|
|
@ -887,11 +888,6 @@ graphStatus TransOpWithoutReshapeFusionPass::GetTransNode(const ComputeGraphPtr
|
|
|
|
|
new_trans_nodes.push_back(cast_node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new_trans_nodes.empty()) {
|
|
|
|
|
GELOGE(GRAPH_FAILED, "no new transop!this should not happen!");
|
|
|
|
|
return GRAPH_FAILED;
|
|
|
|
|
}
|
|
|
|
|
return GRAPH_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -902,6 +898,10 @@ graphStatus TransOpWithoutReshapeFusionPass::InsertNewTransOp(const ComputeGraph
|
|
|
|
|
if (GetTransNode(graph, cast_op, format_transfer_op, insert_cast_first, new_trans_nodes) != GRAPH_SUCCESS) {
|
|
|
|
|
return GRAPH_FAILED;
|
|
|
|
|
}
|
|
|
|
|
if (new_trans_nodes.empty()) {
|
|
|
|
|
GELOGI("No new trans node. Do not need insert new transop.");
|
|
|
|
|
return GRAPH_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pair<OutDataAnchorPtr, InDataAnchorPtr> begin_out = sub_graph_anchors_[index].front();
|
|
|
|
|
pair<OutDataAnchorPtr, InDataAnchorPtr> end_in = sub_graph_anchors_[index].back();
|
|
|
|
@ -1051,8 +1051,7 @@ bool TransOpWithoutReshapeFusionPass::FusionFormatSupport(Format format) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
graphStatus TransOpWithoutReshapeFusionPass::GetSubGraphsBetweenNormalNode(
|
|
|
|
|
const OutDataAnchorPtr &out_anchor,
|
|
|
|
|
std::vector<vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>>> &sub_graphs_out,
|
|
|
|
|
const OutDataAnchorPtr &out_anchor, std::vector<vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>>> &sub_graphs_out,
|
|
|
|
|
vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> &nodes_list) {
|
|
|
|
|
graphStatus ret = GRAPH_SUCCESS;
|
|
|
|
|
if (out_anchor == nullptr) {
|
|
|
|
|