Пример #1
0
def xgraph_dpu_optimizer(xgraph, target=None, **kwargs):
    XGraphPatternAnnotator()(xgraph)
    xgraph = XGraphPatternMutator(xgraph)()

    layout_transform_pass = XGraphLayoutTransformationPass('NHWC', target=target)
    dpu_xgraph = layout_transform_pass.execute(xgraph, subgraphs_only=False)
    
    optimizer = XGraphTfGeneratorOptimizer(dpu_xgraph)
    optimizer.optimize()
    return dpu_xgraph
Пример #2
0
def xgraph_dpu_optimizer(xgraph, target=None, **kwargs):
    # Annoate and merge patterns (e.g. mul + max = leaky relu)
    XGraphPatternAnnotator()(xgraph)
    xgraph = XGraphPatternMutator()(xgraph)

    layout_transform_pass = \
        XGraphLayoutTransformationPass('NHWC', target=target)
    dpu_xgraph = layout_transform_pass.execute(xgraph, subgraphs_only=False)

    # optimizer = QOptimizer(dpu_xgraph)
    # optimizer.optimize()
    optimizer = XGraphTfGeneratorOptimizer(dpu_xgraph)
    optimizer.optimize()

    return dpu_xgraph
Пример #3
0
 def __call__(self, xg: XGraph) -> None:
     """Call Pattern Annotator pass on XGraph before calling default op support functionality"""
     XGraphPatternAnnotator()(xg)
     super(OpSupportPass, self).__call__(xg)