Overview

It is a utility class for GE graph modification, including shape inference, validation of node support, and certain graph optimization methods.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from ge.utils import GeUtils
from ge.graph import Graph, Node

# Shape inference
graph = Graph("my_graph")
# Build a graph.
GeUtils.infer_shape(graph, [[1, 3, 224, 224], [1, 3, 224, 224]])

# Check whether the node is supported on the AI Core.
node = graph.get_node("node_name")
is_supported, reason = GeUtils.check_node_support_on_aicore(node)
if is_supported:
    print("The node is supported on the AI Core.")
else:
    print(f"The node is not supported on the AI Core. Reason: {reason}")