Replace

Applicable Products

All processors

Header File/Library File

  • Header file: #include <ge/fusion/graph_rewriter.h>
  • Library file: libge_compiler.so

Function Usage

Replaces the operators within the given subgraph boundary with a replacement graph.

Prototype

1
2
3
4
static Status Replace(const SubgraphBoundary &subgraph, const Graph &replacement)
static Status Replace(const SubgraphBoundary &subgraph, Graph &&replacement)
static Status Replace(const SubgraphBoundary &subgraph, Graph &&replacement, CustomPassContext &ctx)
static Status Replace(const SubgraphBoundary &subgraph, const Graph &replacement, CustomPassContext &ctx)

Parameters

Parameter

Input/Output

Description

subgraph

Input

Subgraph boundary for replacement.

replacement

Input

Replacement graph, which describes the graph structure to be replaced with.

ctx

Input

Pass context. When this overload is used, the fusion feasibility check (CanFuse) and fusion result reporting (ReportFuse) are automatically performed, and the fusion source is recorded using pass_name in ctx.

Returns

Parameter

Type

Description

-

Status

Whether the replacement is successful.

Restrictions

None