nnvm.graph

NNVM Graph IR API.

This is a developer API that is used to manipulate and transform graphs.

nnvm.graph.create(symbol)

Create a new graph from symbol.

Parameters:symbol (Symbol) – The symbolic graph used to create Graph object.
Returns:graph – A generated new graph object.
Return type:Graph
class nnvm.graph.Graph(handle)

Graph is the graph object that can be used to apply optimization pass.

It contains additional graphwise attribute besides the internal symbol.

apply(passes)

Apply passes to the graph

Parameters:passes (str or list of str) – The passes to be applied
Returns:g – The transformed graph.
Return type:Graph
ir(join_entry_attrs=None, join_node_attrs=None)

Get text form of graph ir.

Parameters:
  • join_entry_attrs (list of str) – List of graph NodeEntry attribute to be printed along each operator.
  • join_node_attrs (list of str) – List of graph node attribute to be printed along each operator.
json()

Get JSON representation of the graph

Returns:json – JSON representation of the graph
Return type:str
json_attr(key)

Get attribute string from the graph.

Parameters:key (str) – The key to get attribute from.
Returns:value – The attribute value of the key, returns None if attribute do not exist.
Return type:str