Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
onnx-array-api 0.3.1 documentation
Logo
onnx-array-api 0.3.1 documentation

Contents

More

Back to top

onnx_array_api.graph_api

GraphBuilder

classonnx_array_api.graph_api.GraphBuilder(target_opset_or_existing_proto:int|Dict[str,int]|ModelProto|FunctionProto|None=None,input_names:Sequence[str]|None=None,as_function:bool=False,optimization_options:OptimizationOptions|None=None,args:List[Any]|None=None,verbose:int=0,ir_version:int|None=None)[source]
add_local_function(domain:str,name:str,gr:GraphBuilder)[source]

Adds a local function.

constant_folding()[source]

Folds all constants. Constants are marked during the creation of the graph.There is no need to propagate this information.

is_constant(name:str)bool[source]

Tells if a result is a constant.

make_nodes(builder:GraphBuilder,input_names:List[str],output_names:List[str],prefix:str='')str|List[str][source]

Appends all nodes and initializers from another builder.Handles the renaming of results.The content stored in ‘builder’ is modified inplace to avoid copying.

Parameters:
  • builder – other builder

  • input_names – input names

  • output_names – output names

  • prefix – prefix all name from this builder

Returns:

output names

np(index:int|None=None,op_type:str|None=None,name:str|None=None)NodePattern[source]

Returns an instance ofNodePattern.

remove_identity_nodes()[source]

Removes identity nodes.

remove_unused()[source]

Simple function to remove unused nodes.It does not look into subgraphs and assumes there is none.Everything is done in one pass.

update_attribute(pat:NodePattern,recursive:bool=False,**kwargs:Dict[str,Any])int[source]

Udates attributes for nodes matching the

Parameters:
  • pat – returned by methodGraphBuilder.np()

  • recursive – walk through subgraph

  • kwargs – attributes to modify

Returns:

number of modified nodes

update_node(node:NodeProto,**kwargs)bool[source]

Updates attributes of a node proto.Returns True if the node was updated.

NodePattern

classonnx_array_api.graph_api.NodePattern(index:int|None=None,op_type:str|None=None,name:None=None)[source]

Class defining a matching pattern able to find nodes in a set of nodes.

find(graph:GraphBuilder)Iterator[source]

Iterates on nodes matching the pattern.

match(index,node:NodeProto)bool[source]

Tells if a node is matching this pattern.

OptimizationOptions

classonnx_array_api.graph_api.graph_builder.OptimizationOptions(remove_unused:bool=True,constant_folding:bool=False,constant_size:int=1024)[source]
On this page

[8]ページ先頭

©2009-2025 Movatter.jp