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

npx.npx_var

Var

classonnx_array_api.npx.npx_var.Var(*inputs:List[Any],op:Callable|str|Tuple[str,str]|FunctionProto|ModelProto|NodeProto|None=None,dtype:type|DType|None=None,inline:bool=False,n_var_outputs:int=1,input_indices:List[int]|None=None,**kwargs)[source]

Defines a variable, a result…

Parameters:
  • inputs – list of inputs

  • op – apply on operator on the inputs

  • inline – True to reduce the use of function and inlinesmall functions, this only applies ifop is a function

  • n_var_outputs – number of the operator outputs

  • input_indices – to select a specific output from the inputoperator

  • kwargs – operator attributes

Private attribute:

Parameters:

onnx_input_type – names given to the variables

propertyT:Var

Transpose.

propertyannotation

Returns a type if known for the Var itself.

astype(dtype)Var[source]

Cast

copy()Var[source]

Returns a copy of self (use of Identity node).

flatten()Var[source]

Flattens a matrix (seenumpy.ndarray.flatten()).

Parameters:

axis – only flatten from axis to the end.

Returns:

Var

get(index:int)Var[source]

If an operator or a function returns more than one output,this takes only one.

Parameters:

index – index of the output to select

Returns:

Var

propertyis_function

Tells if this variable encapsulate a function.

max(axis:TensorType_I__DT7=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.max().

mean(axis:OptParTypeTupleType_int=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.mean().

min(axis:TensorType_I__DT7=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.min().

prod(axis:TensorType_I__DT7=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.prod().

reduce_function(reduce_op,axis:OptTensorType_I__DT7=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.sum() or any other reduce function.

replace_inputs(new_inputs:List[Var],input_indices:List[int]|None=None)Var[source]

Replaces inputs by new ones. It creates a copy.It is needed when inlining functions.

reshape(shape:Var)Var[source]

Reshape

propertyself_var

Returns itself or the variable corresponding to itsstate after a call to__setitem__.

set_onnx_name(prefix:str)[source]

Forces this variable to get this name during

Parameters:

prefix – prefix

propertyshape:Var

Shape

sum(axis:TensorType_I__DT7=None,keepdims:ParTypeint=0)Var[source]

Seenumpy.sum().

to_onnx(target_opsets:Dict[str,int]|None=None,as_function:bool=False,name:str|None=None,domain:str|None=None,attributes:List[str]|None=None,constraints:Dict[Any,TensorType]|None=None,ir_version:int|None=None)ModelProto|FunctionProto|List[Any][source]

Converts the recursive graph to ONNX.

Parameters:
  • target_opsets – dictionary{opset: version}

  • as_function – conversion toonnx.FunctionProtooronnx.ModelProto

  • name – function name ifas_function is True

  • domain – function domain ifas_function is True

  • attributes – function attributes if any

  • constraints – specifies a precise type for the typeconstraints when a function allows more than one type,this works if there is only one variable to be converted

Returns:

ModelProto, FunctionProto

Cst, Input

classonnx_array_api.npx.npx_var.Cst(cst:Any)[source]

Defines a constant.

classonnx_array_api.npx.npx_var.Input(name:str|None=None,annotation:type|None=None)[source]

Defines an input, a placeholder.

Parameters:
  • name – input name or None if undefined

  • annotation – annotation if any is available

propertyannotation

Returns a type if known for the Var itself.

ManyIdentity

classonnx_array_api.npx.npx_var.ManyIdentity(*inputs,input_indices=None)[source]

Holds several instances ofVar.

to_onnx(target_opsets:Dict[str,int]|None=None,as_function:bool=False,name:str|None=None,domain:str|None=None,attributes:List[str]|None=None,constraints:Dict[Any,TensorType]|None=None,ir_version:int|None=None)ModelProto|FunctionProto|List[Any][source]

Converts the recursive graph to ONNX.

Parameters:
  • target_opsets – dictionary{opset: version}, if None,it is replaced byDEFAULT_OPSETS

  • as_function – conversion toonnx.FunctionProtooronnx.ModelProto

  • name – function name ifas_function is True

  • domain – function domain ifas_function is True

  • attributes – function attributes if any

  • constraints – specifies a precise type for the typeconstraints when a function allows more than one type,this works if there is only one variable to be converted

Returns:

ModelProto, FunctionProto

Par

classonnx_array_api.npx.npx_var.Par(name:str,dtype:ParType,value:Any|None=None,parent_op:Tuple[str,str,int]|None=None)[source]

Defines a named parameter.

Parameters:
  • name – parameter name

  • dtype – parameter type (bool, int, str, float)

  • value – value of the parameter if known

  • parent_op – node type it belongs to

propertyonnx_type

Returns the corresponding onnx type.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp