From 49e366cf786f274d591bb6f00ff738b800805232 Mon Sep 17 00:00:00 2001 From: Atanas Dimitrov Date: Mon, 4 Nov 2024 19:08:45 +0200 Subject: [PATCH] Add some proper typing --- src/spox/_fields.py | 87 +- src/spox/_graph.py | 52 +- src/spox/_internal_op.py | 8 +- src/spox/_node.py | 6 +- src/spox/_public.py | 14 +- src/spox/opset/ai/onnx/ml/v3.py | 529 ++-- src/spox/opset/ai/onnx/ml/v4.py | 46 +- src/spox/opset/ai/onnx/ml/v5.py | 67 +- src/spox/opset/ai/onnx/v17.py | 4420 +++++++++++++++++------------- src/spox/opset/ai/onnx/v18.py | 769 +++--- src/spox/opset/ai/onnx/v19.py | 561 ++-- src/spox/opset/ai/onnx/v20.py | 326 ++- src/spox/opset/ai/onnx/v21.py | 598 ++-- tests/test_adapt.py | 12 +- tests/test_custom_operator.py | 8 +- tests/test_function.py | 57 +- tests/test_value_propagation.py | 2 +- tools/templates/construct.jinja2 | 4 +- 18 files changed, 4374 insertions(+), 3192 deletions(-) diff --git a/src/spox/_fields.py b/src/spox/_fields.py index 5bd727b..1286b55 100644 --- a/src/spox/_fields.py +++ b/src/spox/_fields.py @@ -34,6 +34,54 @@ class VarFieldKind(enum.Enum): VARIADIC = 2 +class BaseVars: + def _unpack_to_any(self) -> Any: + """Unpack the stored fields into a tuple of appropriate length, typed as Any.""" + return tuple(self.__dict__.values()) + + def _flatten(self) -> Iterable[tuple[str, Optional[Var]]]: + """Iterate over the pairs of names and values of fields in this object.""" + for key, value in self.__dict__.items(): + if value is None or isinstance(value, Var): + yield key, value + else: + yield from ((f"{key}_{i}", v) for i, v in enumerate(value)) + + def get_vars(self) -> dict[str, Var]: + """Return a flat mapping by name of all the VarInfos in this object.""" + return {key: var for key, var in self._flatten() if var is not None} + + +class BaseVarsMeta(type): + def __new__(cls, name, bases, namespace): + new_cls = super().__new__(cls, name, bases, namespace) + + if bases and "__annotations__" in namespace: + annotations: dict[str, Any] = {} + for name, typ in namespace["__annotations__"].items(): + if typ == VarInfo: + annotations[name] = Var + elif typ == Optional[VarInfo]: + annotations[name] = Optional[Var] + elif typ == Sequence[VarInfo]: + annotations[name] = Sequence[Var] + + vars_cls = dataclass( + type( + "Vars", + ( + BaseVars, + object, + ), + {"__annotations__": annotations}, + ) + ) # type: ignore + + setattr(new_cls, "Vars", vars_cls) + + return new_cls + + @dataclass class BaseVarInfos(BaseFields): def __post_init__(self): @@ -110,12 +158,45 @@ def fully_typed(self) -> bool: @dataclass -class BaseInputs(BaseVarInfos): - pass +class BaseInputs(BaseVarInfos, metaclass=BaseVarsMeta): + @dataclass + class Vars(BaseVars): + pass + + def vars(self, prop_values) -> Vars: + vars_structure: dict[str, Union[Var, Sequence[Var]]] = {} + + for field in dataclasses.fields(self): + field_type = self._get_field_type(field) + field_value = getattr(self, field.name) + + if field_type == VarFieldKind.SINGLE: + vars_structure[field.name] = Var(field_value, prop_values[field.name]) + + elif ( + field_type == VarFieldKind.OPTIONAL + and prop_values.get(field.name, None) is not None + ): + vars_structure[field.name] = Var(field_value, prop_values[field.name]) + + elif field_type == VarFieldKind.VARIADIC: + vars = [] + + for i, var_info in enumerate(field_value): + var_value = prop_values.get(f"{field.name}_{i}", None) + vars.append(Var(var_info, var_value)) + + vars_structure[field.name] = vars + + return self.Vars(**vars_structure) @dataclass -class BaseOutputs(BaseVarInfos): +class BaseOutputs(BaseVarInfos, metaclass=BaseVarsMeta): + @dataclass + class Vars(BaseVars): + pass + def _propagate_vars( self, prop_values={}, diff --git a/src/spox/_graph.py b/src/spox/_graph.py index 0470b28..f7a6999 100644 --- a/src/spox/_graph.py +++ b/src/spox/_graph.py @@ -43,24 +43,32 @@ def arguments_dict(**kwargs: Optional[Union[Type, np.ndarray]]) -> dict[str, Var for name, info in kwargs.items(): attr_name = AttrString(value=name, name="dummy") if isinstance(info, Type): - result[name] = Argument( - Argument.Attributes( - name=attr_name, - type=AttrType(value=info, name="dummy"), - default=None, - ), - BaseInputs(), - ).get_output_vars()["arg"] + result[name] = ( + Argument( + Argument.Attributes( + name=attr_name, + type=AttrType(value=info, name="dummy"), + default=None, + ), + BaseInputs(), + ) + .get_output_vars() + .arg + ) elif isinstance(info, np.ndarray): ty = Tensor(info.dtype, info.shape) - result[name] = Argument( - Argument.Attributes( - name=attr_name, - type=AttrType(value=ty, name="dummy"), - default=AttrTensor(value=info, name="dummy"), - ), - BaseInputs(), - ).get_output_vars()["arg"] + result[name] = ( + Argument( + Argument.Attributes( + name=attr_name, + type=AttrType(value=ty, name="dummy"), + default=AttrTensor(value=info, name="dummy"), + ), + BaseInputs(), + ) + .get_output_vars() + .arg + ) else: raise TypeError(f"Cannot construct argument from {type(info)}.") return result @@ -110,10 +118,14 @@ def initializer(arr: np.ndarray) -> Var: ------- Var which is always equal to the respective value provided by `arr`. """ - return _Initializer( - _Initializer.Attributes(value=AttrTensor(value=arr, name="dummy")), - BaseInputs(), - ).get_output_vars()["arg"] + return ( + _Initializer( + _Initializer.Attributes(value=AttrTensor(value=arr, name="dummy")), + BaseInputs(), + ) + .get_output_vars() + .arg + ) @dataclass(frozen=True, eq=False) diff --git a/src/spox/_internal_op.py b/src/spox/_internal_op.py index f734aff..835c451 100644 --- a/src/spox/_internal_op.py +++ b/src/spox/_internal_op.py @@ -213,9 +213,11 @@ def intros(*args: Var) -> Sequence[Var]: Sequence[Var] Vars of the same value as ``args``, but with a shared dependency. """ - return _Introduce( - None, _Introduce.Inputs(unwrap_vars(args)), out_variadic=len(args) - ).get_output_vars()["outputs"] + return ( + _Introduce(None, _Introduce.Inputs(unwrap_vars(args)), out_variadic=len(args)) + .get_output_vars() + .outputs + ) def intro(*args: Var) -> Var: diff --git a/src/spox/_node.py b/src/spox/_node.py index ce69b9b..85d0ba3 100644 --- a/src/spox/_node.py +++ b/src/spox/_node.py @@ -236,8 +236,10 @@ def inference(self, infer_types: bool = True): def get_output_vars(self, flatten_variadic=False, **initializers): # After typing everything, try to get values for outputs out_values = self.propagate_values(initializers) - return self.outputs._propagate_vars( - out_values, flatten_variadic=flatten_variadic + return type(self.outputs).Vars( + **self.outputs._propagate_vars( + out_values, flatten_variadic=flatten_variadic + ) ) def validate_types(self) -> None: diff --git a/src/spox/_public.py b/src/spox/_public.py index 20385fd..a3b77da 100644 --- a/src/spox/_public.py +++ b/src/spox/_public.py @@ -35,9 +35,13 @@ def argument(typ: Type) -> Var: An unnamed argument variable of given type that may be used as a model input to build a graph. """ - return _internal_op.Argument( - _internal_op.Argument.Attributes(type=AttrType(typ, "dummy"), default=None) - ).get_output_vars()["arg"] + return ( + _internal_op.Argument( + _internal_op.Argument.Attributes(type=AttrType(typ, "dummy"), default=None) + ) + .get_output_vars() + .arg + ) @contextlib.contextmanager @@ -303,9 +307,7 @@ def inline_inner(*args: Var, **kwargs: Var) -> dict[str, Var]: model=model, ) - return dict( - zip(out_names, node.get_output_vars(flatten_variadic=True).values()) - ) + return dict(zip(out_names, node.get_output_vars().get_vars().values())) return inline_inner diff --git a/src/spox/opset/ai/onnx/ml/v3.py b/src/spox/opset/ai/onnx/ml/v3.py index a3b2395..c80ce52 100644 --- a/src/spox/opset/ai/onnx/ml/v3.py +++ b/src/spox/opset/ai/onnx/ml/v3.py @@ -662,16 +662,20 @@ def array_feature_extractor( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)`, `tensor(string)` """ - return _ArrayFeatureExtractor( - _ArrayFeatureExtractor.Attributes(), - _ArrayFeatureExtractor.Inputs( - X=unwrap_vars(X), - Y=unwrap_vars(Y), - ), - ).get_output_vars( - X=get_value(X), - Y=get_value(Y), - )["Z"] + return ( + _ArrayFeatureExtractor( + _ArrayFeatureExtractor.Attributes(), + _ArrayFeatureExtractor.Inputs( + X=unwrap_vars(X), + Y=unwrap_vars(Y), + ), + ) + .get_output_vars( + X=get_value(X), + Y=get_value(Y), + ) + .Z + ) def binarizer( @@ -705,16 +709,20 @@ def binarizer( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _Binarizer( - _Binarizer.Attributes( - threshold=AttrFloat32(threshold, name="threshold"), - ), - _Binarizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Binarizer( + _Binarizer.Attributes( + threshold=AttrFloat32(threshold, name="threshold"), + ), + _Binarizer.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def cast_map( @@ -764,18 +772,22 @@ def cast_map( - T1: `map(int64,tensor(float))`, `map(int64,tensor(string))` - T2: `tensor(float)`, `tensor(int64)`, `tensor(string)` """ - return _CastMap( - _CastMap.Attributes( - cast_to=AttrString(cast_to, name="cast_to"), - map_form=AttrString(map_form, name="map_form"), - max_map=AttrInt64(max_map, name="max_map"), - ), - _CastMap.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _CastMap( + _CastMap.Attributes( + cast_to=AttrString(cast_to, name="cast_to"), + map_form=AttrString(map_form, name="map_form"), + max_map=AttrInt64(max_map, name="max_map"), + ), + _CastMap.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def category_mapper( @@ -833,19 +845,23 @@ def category_mapper( - T1: `tensor(int64)`, `tensor(string)` - T2: `tensor(int64)`, `tensor(string)` """ - return _CategoryMapper( - _CategoryMapper.Attributes( - cats_int64s=AttrInt64s.maybe(cats_int64s, name="cats_int64s"), - cats_strings=AttrStrings.maybe(cats_strings, name="cats_strings"), - default_int64=AttrInt64(default_int64, name="default_int64"), - default_string=AttrString(default_string, name="default_string"), - ), - _CategoryMapper.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _CategoryMapper( + _CategoryMapper.Attributes( + cats_int64s=AttrInt64s.maybe(cats_int64s, name="cats_int64s"), + cats_strings=AttrStrings.maybe(cats_strings, name="cats_strings"), + default_int64=AttrInt64(default_int64, name="default_int64"), + default_string=AttrString(default_string, name="default_string"), + ), + _CategoryMapper.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def dict_vectorizer( @@ -898,21 +914,25 @@ def dict_vectorizer( - T1: `map(int64,tensor(double))`, `map(int64,tensor(float))`, `map(int64,tensor(string))`, `map(string,tensor(double))`, `map(string,tensor(float))`, `map(string,tensor(int64))` - T2: `tensor(double)`, `tensor(float)`, `tensor(int64)`, `tensor(string)` """ - return _DictVectorizer( - _DictVectorizer.Attributes( - int64_vocabulary=AttrInt64s.maybe( - int64_vocabulary, name="int64_vocabulary" + return ( + _DictVectorizer( + _DictVectorizer.Attributes( + int64_vocabulary=AttrInt64s.maybe( + int64_vocabulary, name="int64_vocabulary" + ), + string_vocabulary=AttrStrings.maybe( + string_vocabulary, name="string_vocabulary" + ), ), - string_vocabulary=AttrStrings.maybe( - string_vocabulary, name="string_vocabulary" + _DictVectorizer.Inputs( + X=unwrap_vars(X), ), - ), - _DictVectorizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def feature_vectorizer( @@ -949,16 +969,22 @@ def feature_vectorizer( Type constraints: - T1: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _FeatureVectorizer( - _FeatureVectorizer.Attributes( - inputdimensions=AttrInt64s.maybe(inputdimensions, name="inputdimensions"), - ), - _FeatureVectorizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _FeatureVectorizer( + _FeatureVectorizer.Attributes( + inputdimensions=AttrInt64s.maybe( + inputdimensions, name="inputdimensions" + ), + ), + _FeatureVectorizer.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def imputer( @@ -1016,27 +1042,31 @@ def imputer( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _Imputer( - _Imputer.Attributes( - imputed_value_floats=AttrFloat32s.maybe( - imputed_value_floats, name="imputed_value_floats" - ), - imputed_value_int64s=AttrInt64s.maybe( - imputed_value_int64s, name="imputed_value_int64s" - ), - replaced_value_float=AttrFloat32( - replaced_value_float, name="replaced_value_float" + return ( + _Imputer( + _Imputer.Attributes( + imputed_value_floats=AttrFloat32s.maybe( + imputed_value_floats, name="imputed_value_floats" + ), + imputed_value_int64s=AttrInt64s.maybe( + imputed_value_int64s, name="imputed_value_int64s" + ), + replaced_value_float=AttrFloat32( + replaced_value_float, name="replaced_value_float" + ), + replaced_value_int64=AttrInt64( + replaced_value_int64, name="replaced_value_int64" + ), ), - replaced_value_int64=AttrInt64( - replaced_value_int64, name="replaced_value_int64" + _Imputer.Inputs( + X=unwrap_vars(X), ), - ), - _Imputer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def label_encoder( @@ -1119,24 +1149,28 @@ def label_encoder( - T1: `tensor(float)`, `tensor(int64)`, `tensor(string)` - T2: `tensor(float)`, `tensor(int64)`, `tensor(string)` """ - return _LabelEncoder( - _LabelEncoder.Attributes( - default_float=AttrFloat32(default_float, name="default_float"), - default_int64=AttrInt64(default_int64, name="default_int64"), - default_string=AttrString(default_string, name="default_string"), - keys_floats=AttrFloat32s.maybe(keys_floats, name="keys_floats"), - keys_int64s=AttrInt64s.maybe(keys_int64s, name="keys_int64s"), - keys_strings=AttrStrings.maybe(keys_strings, name="keys_strings"), - values_floats=AttrFloat32s.maybe(values_floats, name="values_floats"), - values_int64s=AttrInt64s.maybe(values_int64s, name="values_int64s"), - values_strings=AttrStrings.maybe(values_strings, name="values_strings"), - ), - _LabelEncoder.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LabelEncoder( + _LabelEncoder.Attributes( + default_float=AttrFloat32(default_float, name="default_float"), + default_int64=AttrInt64(default_int64, name="default_int64"), + default_string=AttrString(default_string, name="default_string"), + keys_floats=AttrFloat32s.maybe(keys_floats, name="keys_floats"), + keys_int64s=AttrInt64s.maybe(keys_int64s, name="keys_int64s"), + keys_strings=AttrStrings.maybe(keys_strings, name="keys_strings"), + values_floats=AttrFloat32s.maybe(values_floats, name="values_floats"), + values_int64s=AttrInt64s.maybe(values_int64s, name="values_int64s"), + values_strings=AttrStrings.maybe(values_strings, name="values_strings"), + ), + _LabelEncoder.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def linear_classifier( @@ -1217,7 +1251,7 @@ def linear_classifier( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) @@ -1270,19 +1304,23 @@ def linear_regressor( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _LinearRegressor( - _LinearRegressor.Attributes( - coefficients=AttrFloat32s.maybe(coefficients, name="coefficients"), - intercepts=AttrFloat32s.maybe(intercepts, name="intercepts"), - post_transform=AttrString(post_transform, name="post_transform"), - targets=AttrInt64(targets, name="targets"), - ), - _LinearRegressor.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LinearRegressor( + _LinearRegressor.Attributes( + coefficients=AttrFloat32s.maybe(coefficients, name="coefficients"), + intercepts=AttrFloat32s.maybe(intercepts, name="intercepts"), + post_transform=AttrString(post_transform, name="post_transform"), + targets=AttrInt64(targets, name="targets"), + ), + _LinearRegressor.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def normalizer( @@ -1321,16 +1359,20 @@ def normalizer( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _Normalizer( - _Normalizer.Attributes( - norm=AttrString(norm, name="norm"), - ), - _Normalizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Normalizer( + _Normalizer.Attributes( + norm=AttrString(norm, name="norm"), + ), + _Normalizer.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def one_hot_encoder( @@ -1382,18 +1424,22 @@ def one_hot_encoder( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)`, `tensor(string)` """ - return _OneHotEncoder( - _OneHotEncoder.Attributes( - cats_int64s=AttrInt64s.maybe(cats_int64s, name="cats_int64s"), - cats_strings=AttrStrings.maybe(cats_strings, name="cats_strings"), - zeros=AttrInt64(zeros, name="zeros"), - ), - _OneHotEncoder.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _OneHotEncoder( + _OneHotEncoder.Attributes( + cats_int64s=AttrInt64s.maybe(cats_int64s, name="cats_int64s"), + cats_strings=AttrStrings.maybe(cats_strings, name="cats_strings"), + zeros=AttrInt64(zeros, name="zeros"), + ), + _OneHotEncoder.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def svmclassifier( @@ -1508,7 +1554,7 @@ def svmclassifier( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) @@ -1573,23 +1619,29 @@ def svmregressor( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _SVMRegressor( - _SVMRegressor.Attributes( - coefficients=AttrFloat32s.maybe(coefficients, name="coefficients"), - kernel_params=AttrFloat32s.maybe(kernel_params, name="kernel_params"), - kernel_type=AttrString(kernel_type, name="kernel_type"), - n_supports=AttrInt64(n_supports, name="n_supports"), - one_class=AttrInt64(one_class, name="one_class"), - post_transform=AttrString(post_transform, name="post_transform"), - rho=AttrFloat32s.maybe(rho, name="rho"), - support_vectors=AttrFloat32s.maybe(support_vectors, name="support_vectors"), - ), - _SVMRegressor.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _SVMRegressor( + _SVMRegressor.Attributes( + coefficients=AttrFloat32s.maybe(coefficients, name="coefficients"), + kernel_params=AttrFloat32s.maybe(kernel_params, name="kernel_params"), + kernel_type=AttrString(kernel_type, name="kernel_type"), + n_supports=AttrInt64(n_supports, name="n_supports"), + one_class=AttrInt64(one_class, name="one_class"), + post_transform=AttrString(post_transform, name="post_transform"), + rho=AttrFloat32s.maybe(rho, name="rho"), + support_vectors=AttrFloat32s.maybe( + support_vectors, name="support_vectors" + ), + ), + _SVMRegressor.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def scaler( @@ -1631,17 +1683,21 @@ def scaler( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _Scaler( - _Scaler.Attributes( - offset=AttrFloat32s.maybe(offset, name="offset"), - scale=AttrFloat32s.maybe(scale, name="scale"), - ), - _Scaler.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Scaler( + _Scaler.Attributes( + offset=AttrFloat32s.maybe(offset, name="offset"), + scale=AttrFloat32s.maybe(scale, name="scale"), + ), + _Scaler.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def tree_ensemble_classifier( @@ -1833,7 +1889,7 @@ def tree_ensemble_classifier( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) @@ -1969,54 +2025,63 @@ def tree_ensemble_regressor( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` """ - return _TreeEnsembleRegressor( - _TreeEnsembleRegressor.Attributes( - aggregate_function=AttrString( - aggregate_function, name="aggregate_function" - ), - base_values=AttrFloat32s.maybe(base_values, name="base_values"), - base_values_as_tensor=AttrTensor.maybe( - base_values_as_tensor, name="base_values_as_tensor" - ), - n_targets=AttrInt64.maybe(n_targets, name="n_targets"), - nodes_falsenodeids=AttrInt64s.maybe( - nodes_falsenodeids, name="nodes_falsenodeids" - ), - nodes_featureids=AttrInt64s.maybe( - nodes_featureids, name="nodes_featureids" - ), - nodes_hitrates=AttrFloat32s.maybe(nodes_hitrates, name="nodes_hitrates"), - nodes_hitrates_as_tensor=AttrTensor.maybe( - nodes_hitrates_as_tensor, name="nodes_hitrates_as_tensor" - ), - nodes_missing_value_tracks_true=AttrInt64s.maybe( - nodes_missing_value_tracks_true, name="nodes_missing_value_tracks_true" - ), - nodes_modes=AttrStrings.maybe(nodes_modes, name="nodes_modes"), - nodes_nodeids=AttrInt64s.maybe(nodes_nodeids, name="nodes_nodeids"), - nodes_treeids=AttrInt64s.maybe(nodes_treeids, name="nodes_treeids"), - nodes_truenodeids=AttrInt64s.maybe( - nodes_truenodeids, name="nodes_truenodeids" - ), - nodes_values=AttrFloat32s.maybe(nodes_values, name="nodes_values"), - nodes_values_as_tensor=AttrTensor.maybe( - nodes_values_as_tensor, name="nodes_values_as_tensor" + return ( + _TreeEnsembleRegressor( + _TreeEnsembleRegressor.Attributes( + aggregate_function=AttrString( + aggregate_function, name="aggregate_function" + ), + base_values=AttrFloat32s.maybe(base_values, name="base_values"), + base_values_as_tensor=AttrTensor.maybe( + base_values_as_tensor, name="base_values_as_tensor" + ), + n_targets=AttrInt64.maybe(n_targets, name="n_targets"), + nodes_falsenodeids=AttrInt64s.maybe( + nodes_falsenodeids, name="nodes_falsenodeids" + ), + nodes_featureids=AttrInt64s.maybe( + nodes_featureids, name="nodes_featureids" + ), + nodes_hitrates=AttrFloat32s.maybe( + nodes_hitrates, name="nodes_hitrates" + ), + nodes_hitrates_as_tensor=AttrTensor.maybe( + nodes_hitrates_as_tensor, name="nodes_hitrates_as_tensor" + ), + nodes_missing_value_tracks_true=AttrInt64s.maybe( + nodes_missing_value_tracks_true, + name="nodes_missing_value_tracks_true", + ), + nodes_modes=AttrStrings.maybe(nodes_modes, name="nodes_modes"), + nodes_nodeids=AttrInt64s.maybe(nodes_nodeids, name="nodes_nodeids"), + nodes_treeids=AttrInt64s.maybe(nodes_treeids, name="nodes_treeids"), + nodes_truenodeids=AttrInt64s.maybe( + nodes_truenodeids, name="nodes_truenodeids" + ), + nodes_values=AttrFloat32s.maybe(nodes_values, name="nodes_values"), + nodes_values_as_tensor=AttrTensor.maybe( + nodes_values_as_tensor, name="nodes_values_as_tensor" + ), + post_transform=AttrString(post_transform, name="post_transform"), + target_ids=AttrInt64s.maybe(target_ids, name="target_ids"), + target_nodeids=AttrInt64s.maybe(target_nodeids, name="target_nodeids"), + target_treeids=AttrInt64s.maybe(target_treeids, name="target_treeids"), + target_weights=AttrFloat32s.maybe( + target_weights, name="target_weights" + ), + target_weights_as_tensor=AttrTensor.maybe( + target_weights_as_tensor, name="target_weights_as_tensor" + ), ), - post_transform=AttrString(post_transform, name="post_transform"), - target_ids=AttrInt64s.maybe(target_ids, name="target_ids"), - target_nodeids=AttrInt64s.maybe(target_nodeids, name="target_nodeids"), - target_treeids=AttrInt64s.maybe(target_treeids, name="target_treeids"), - target_weights=AttrFloat32s.maybe(target_weights, name="target_weights"), - target_weights_as_tensor=AttrTensor.maybe( - target_weights_as_tensor, name="target_weights_as_tensor" + _TreeEnsembleRegressor.Inputs( + X=unwrap_vars(X), ), - ), - _TreeEnsembleRegressor.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def zip_map( @@ -2059,21 +2124,25 @@ def zip_map( Type constraints: - T: `seq(map(int64,tensor(float)))`, `seq(map(string,tensor(float)))` """ - return _ZipMap( - _ZipMap.Attributes( - classlabels_int64s=AttrInt64s.maybe( - classlabels_int64s, name="classlabels_int64s" + return ( + _ZipMap( + _ZipMap.Attributes( + classlabels_int64s=AttrInt64s.maybe( + classlabels_int64s, name="classlabels_int64s" + ), + classlabels_strings=AttrStrings.maybe( + classlabels_strings, name="classlabels_strings" + ), ), - classlabels_strings=AttrStrings.maybe( - classlabels_strings, name="classlabels_strings" + _ZipMap.Inputs( + X=unwrap_vars(X), ), - ), - _ZipMap.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Z"] + ) + .get_output_vars( + X=get_value(X), + ) + .Z + ) _OPERATORS = { diff --git a/src/spox/opset/ai/onnx/ml/v4.py b/src/spox/opset/ai/onnx/ml/v4.py index c9247b2..2e4871c 100644 --- a/src/spox/opset/ai/onnx/ml/v4.py +++ b/src/spox/opset/ai/onnx/ml/v4.py @@ -191,27 +191,31 @@ def label_encoder( - T1: `tensor(double)`, `tensor(float)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(string)` - T2: `tensor(double)`, `tensor(float)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(string)` """ - return _LabelEncoder( - _LabelEncoder.Attributes( - default_float=AttrFloat32(default_float, name="default_float"), - default_int64=AttrInt64(default_int64, name="default_int64"), - default_string=AttrString(default_string, name="default_string"), - default_tensor=AttrTensor.maybe(default_tensor, name="default_tensor"), - keys_floats=AttrFloat32s.maybe(keys_floats, name="keys_floats"), - keys_int64s=AttrInt64s.maybe(keys_int64s, name="keys_int64s"), - keys_strings=AttrStrings.maybe(keys_strings, name="keys_strings"), - keys_tensor=AttrTensor.maybe(keys_tensor, name="keys_tensor"), - values_floats=AttrFloat32s.maybe(values_floats, name="values_floats"), - values_int64s=AttrInt64s.maybe(values_int64s, name="values_int64s"), - values_strings=AttrStrings.maybe(values_strings, name="values_strings"), - values_tensor=AttrTensor.maybe(values_tensor, name="values_tensor"), - ), - _LabelEncoder.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LabelEncoder( + _LabelEncoder.Attributes( + default_float=AttrFloat32(default_float, name="default_float"), + default_int64=AttrInt64(default_int64, name="default_int64"), + default_string=AttrString(default_string, name="default_string"), + default_tensor=AttrTensor.maybe(default_tensor, name="default_tensor"), + keys_floats=AttrFloat32s.maybe(keys_floats, name="keys_floats"), + keys_int64s=AttrInt64s.maybe(keys_int64s, name="keys_int64s"), + keys_strings=AttrStrings.maybe(keys_strings, name="keys_strings"), + keys_tensor=AttrTensor.maybe(keys_tensor, name="keys_tensor"), + values_floats=AttrFloat32s.maybe(values_floats, name="values_floats"), + values_int64s=AttrInt64s.maybe(values_int64s, name="values_int64s"), + values_strings=AttrStrings.maybe(values_strings, name="values_strings"), + values_tensor=AttrTensor.maybe(values_tensor, name="values_tensor"), + ), + _LabelEncoder.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) _OPERATORS = { diff --git a/src/spox/opset/ai/onnx/ml/v5.py b/src/spox/opset/ai/onnx/ml/v5.py index 6843a8c..c35f6c9 100644 --- a/src/spox/opset/ai/onnx/ml/v5.py +++ b/src/spox/opset/ai/onnx/ml/v5.py @@ -224,37 +224,46 @@ def tree_ensemble( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _TreeEnsemble( - _TreeEnsemble.Attributes( - aggregate_function=AttrInt64(aggregate_function, name="aggregate_function"), - leaf_targetids=AttrInt64s(leaf_targetids, name="leaf_targetids"), - leaf_weights=AttrTensor(leaf_weights, name="leaf_weights"), - membership_values=AttrTensor.maybe( - membership_values, name="membership_values" + return ( + _TreeEnsemble( + _TreeEnsemble.Attributes( + aggregate_function=AttrInt64( + aggregate_function, name="aggregate_function" + ), + leaf_targetids=AttrInt64s(leaf_targetids, name="leaf_targetids"), + leaf_weights=AttrTensor(leaf_weights, name="leaf_weights"), + membership_values=AttrTensor.maybe( + membership_values, name="membership_values" + ), + n_targets=AttrInt64.maybe(n_targets, name="n_targets"), + nodes_falseleafs=AttrInt64s(nodes_falseleafs, name="nodes_falseleafs"), + nodes_falsenodeids=AttrInt64s( + nodes_falsenodeids, name="nodes_falsenodeids" + ), + nodes_featureids=AttrInt64s(nodes_featureids, name="nodes_featureids"), + nodes_hitrates=AttrTensor.maybe(nodes_hitrates, name="nodes_hitrates"), + nodes_missing_value_tracks_true=AttrInt64s.maybe( + nodes_missing_value_tracks_true, + name="nodes_missing_value_tracks_true", + ), + nodes_modes=AttrTensor(nodes_modes, name="nodes_modes"), + nodes_splits=AttrTensor(nodes_splits, name="nodes_splits"), + nodes_trueleafs=AttrInt64s(nodes_trueleafs, name="nodes_trueleafs"), + nodes_truenodeids=AttrInt64s( + nodes_truenodeids, name="nodes_truenodeids" + ), + post_transform=AttrInt64(post_transform, name="post_transform"), + tree_roots=AttrInt64s(tree_roots, name="tree_roots"), ), - n_targets=AttrInt64.maybe(n_targets, name="n_targets"), - nodes_falseleafs=AttrInt64s(nodes_falseleafs, name="nodes_falseleafs"), - nodes_falsenodeids=AttrInt64s( - nodes_falsenodeids, name="nodes_falsenodeids" + _TreeEnsemble.Inputs( + X=unwrap_vars(X), ), - nodes_featureids=AttrInt64s(nodes_featureids, name="nodes_featureids"), - nodes_hitrates=AttrTensor.maybe(nodes_hitrates, name="nodes_hitrates"), - nodes_missing_value_tracks_true=AttrInt64s.maybe( - nodes_missing_value_tracks_true, name="nodes_missing_value_tracks_true" - ), - nodes_modes=AttrTensor(nodes_modes, name="nodes_modes"), - nodes_splits=AttrTensor(nodes_splits, name="nodes_splits"), - nodes_trueleafs=AttrInt64s(nodes_trueleafs, name="nodes_trueleafs"), - nodes_truenodeids=AttrInt64s(nodes_truenodeids, name="nodes_truenodeids"), - post_transform=AttrInt64(post_transform, name="post_transform"), - tree_roots=AttrInt64s(tree_roots, name="tree_roots"), - ), - _TreeEnsemble.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) _OPERATORS = { diff --git a/src/spox/opset/ai/onnx/v17.py b/src/spox/opset/ai/onnx/v17.py index 1164531..cc4ffc6 100644 --- a/src/spox/opset/ai/onnx/v17.py +++ b/src/spox/opset/ai/onnx/v17.py @@ -3958,14 +3958,18 @@ def abs( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Abs( - _Abs.Attributes(), - _Abs.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Abs( + _Abs.Attributes(), + _Abs.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def acos( @@ -3994,14 +3998,18 @@ def acos( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Acos( - _Acos.Attributes(), - _Acos.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Acos( + _Acos.Attributes(), + _Acos.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def acosh( @@ -4031,14 +4039,18 @@ def acosh( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Acosh( - _Acosh.Attributes(), - _Acosh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Acosh( + _Acosh.Attributes(), + _Acosh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def add( @@ -4078,16 +4090,20 @@ def add( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Add( - _Add.Attributes(), - _Add.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Add( + _Add.Attributes(), + _Add.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def and_( @@ -4126,16 +4142,20 @@ def and_( - T: `tensor(bool)` - T1: `tensor(bool)` """ - return _And( - _And.Attributes(), - _And.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _And( + _And.Attributes(), + _And.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def arg_max( @@ -4186,18 +4206,24 @@ def arg_max( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ArgMax( - _ArgMax.Attributes( - axis=AttrInt64(axis, name="axis"), - keepdims=AttrInt64(keepdims, name="keepdims"), - select_last_index=AttrInt64(select_last_index, name="select_last_index"), - ), - _ArgMax.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ArgMax( + _ArgMax.Attributes( + axis=AttrInt64(axis, name="axis"), + keepdims=AttrInt64(keepdims, name="keepdims"), + select_last_index=AttrInt64( + select_last_index, name="select_last_index" + ), + ), + _ArgMax.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def arg_min( @@ -4248,18 +4274,24 @@ def arg_min( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ArgMin( - _ArgMin.Attributes( - axis=AttrInt64(axis, name="axis"), - keepdims=AttrInt64(keepdims, name="keepdims"), - select_last_index=AttrInt64(select_last_index, name="select_last_index"), - ), - _ArgMin.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ArgMin( + _ArgMin.Attributes( + axis=AttrInt64(axis, name="axis"), + keepdims=AttrInt64(keepdims, name="keepdims"), + select_last_index=AttrInt64( + select_last_index, name="select_last_index" + ), + ), + _ArgMin.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def asin( @@ -4288,14 +4320,18 @@ def asin( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Asin( - _Asin.Attributes(), - _Asin.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Asin( + _Asin.Attributes(), + _Asin.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def asinh( @@ -4324,14 +4360,18 @@ def asinh( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Asinh( - _Asinh.Attributes(), - _Asinh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Asinh( + _Asinh.Attributes(), + _Asinh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def atan( @@ -4360,14 +4400,18 @@ def atan( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Atan( - _Atan.Attributes(), - _Atan.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Atan( + _Atan.Attributes(), + _Atan.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def atanh( @@ -4397,14 +4441,18 @@ def atanh( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Atanh( - _Atanh.Attributes(), - _Atanh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Atanh( + _Atanh.Attributes(), + _Atanh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def average_pool( @@ -4528,21 +4576,27 @@ def average_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _AveragePool( - _AveragePool.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), - count_include_pad=AttrInt64(count_include_pad, name="count_include_pad"), - kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _AveragePool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _AveragePool( + _AveragePool.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), + count_include_pad=AttrInt64( + count_include_pad, name="count_include_pad" + ), + kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _AveragePool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def batch_normalization( @@ -4687,7 +4741,7 @@ def batch_normalization( input_mean=get_value(input_mean), input_var=get_value(input_var), ) - .values() + ._unpack_to_any() ) @@ -4736,17 +4790,21 @@ def bernoulli( - T1: `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Bernoulli( - _Bernoulli.Attributes( - dtype=AttrDtype.maybe(dtype, name="dtype"), - seed=AttrFloat32.maybe(seed, name="seed"), - ), - _Bernoulli.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Bernoulli( + _Bernoulli.Attributes( + dtype=AttrDtype.maybe(dtype, name="dtype"), + seed=AttrFloat32.maybe(seed, name="seed"), + ), + _Bernoulli.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def bit_shift( @@ -4799,18 +4857,22 @@ def bit_shift( Type constraints: - T: `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BitShift( - _BitShift.Attributes( - direction=AttrString(direction, name="direction"), - ), - _BitShift.Inputs( - X=unwrap_vars(X), - Y=unwrap_vars(Y), - ), - ).get_output_vars( - X=get_value(X), - Y=get_value(Y), - )["Z"] + return ( + _BitShift( + _BitShift.Attributes( + direction=AttrString(direction, name="direction"), + ), + _BitShift.Inputs( + X=unwrap_vars(X), + Y=unwrap_vars(Y), + ), + ) + .get_output_vars( + X=get_value(X), + Y=get_value(Y), + ) + .Z + ) def blackman_window( @@ -4854,17 +4916,21 @@ def blackman_window( - T1: `tensor(int32)`, `tensor(int64)` - T2: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BlackmanWindow( - _BlackmanWindow.Attributes( - output_datatype=AttrInt64(output_datatype, name="output_datatype"), - periodic=AttrInt64(periodic, name="periodic"), - ), - _BlackmanWindow.Inputs( - size=unwrap_vars(size), - ), - ).get_output_vars( - size=get_value(size), - )["output"] + return ( + _BlackmanWindow( + _BlackmanWindow.Attributes( + output_datatype=AttrInt64(output_datatype, name="output_datatype"), + periodic=AttrInt64(periodic, name="periodic"), + ), + _BlackmanWindow.Inputs( + size=unwrap_vars(size), + ), + ) + .get_output_vars( + size=get_value(size), + ) + .output + ) def cast( @@ -4949,16 +5015,20 @@ def cast( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Cast( - _Cast.Attributes( - to=AttrDtype(to, name="to"), - ), - _Cast.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Cast( + _Cast.Attributes( + to=AttrDtype(to, name="to"), + ), + _Cast.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def cast_like( @@ -4995,16 +5065,20 @@ def cast_like( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _CastLike( - _CastLike.Attributes(), - _CastLike.Inputs( - input=unwrap_vars(input), - target_type=unwrap_vars(target_type), - ), - ).get_output_vars( - input=get_value(input), - target_type=get_value(target_type), - )["output"] + return ( + _CastLike( + _CastLike.Attributes(), + _CastLike.Inputs( + input=unwrap_vars(input), + target_type=unwrap_vars(target_type), + ), + ) + .get_output_vars( + input=get_value(input), + target_type=get_value(target_type), + ) + .output + ) def ceil( @@ -5035,14 +5109,18 @@ def ceil( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Ceil( - _Ceil.Attributes(), - _Ceil.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Ceil( + _Ceil.Attributes(), + _Ceil.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def celu( @@ -5081,16 +5159,20 @@ def celu( Type constraints: - T: `tensor(float)` """ - return _Celu( - _Celu.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - ), - _Celu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Celu( + _Celu.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + ), + _Celu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def clip( @@ -5130,18 +5212,22 @@ def clip( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Clip( - _Clip.Attributes(), - _Clip.Inputs( - input=unwrap_vars(input), - min=unwrap_vars(min), - max=unwrap_vars(max), - ), - ).get_output_vars( - input=get_value(input), - min=get_value(min), - max=get_value(max), - )["output"] + return ( + _Clip( + _Clip.Attributes(), + _Clip.Inputs( + input=unwrap_vars(input), + min=unwrap_vars(min), + max=unwrap_vars(max), + ), + ) + .get_output_vars( + input=get_value(input), + min=get_value(min), + max=get_value(max), + ) + .output + ) def compress( @@ -5190,18 +5276,22 @@ def compress( - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _Compress( - _Compress.Attributes( - axis=AttrInt64.maybe(axis, name="axis"), - ), - _Compress.Inputs( - input=unwrap_vars(input), - condition=unwrap_vars(condition), - ), - ).get_output_vars( - input=get_value(input), - condition=get_value(condition), - )["output"] + return ( + _Compress( + _Compress.Attributes( + axis=AttrInt64.maybe(axis, name="axis"), + ), + _Compress.Inputs( + input=unwrap_vars(input), + condition=unwrap_vars(condition), + ), + ) + .get_output_vars( + input=get_value(input), + condition=get_value(condition), + ) + .output + ) def concat( @@ -5237,16 +5327,20 @@ def concat( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Concat( - _Concat.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Concat.Inputs( - inputs=unwrap_vars(inputs), - ), - ).get_output_vars( - inputs=get_value(inputs), - )["concat_result"] + return ( + _Concat( + _Concat.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Concat.Inputs( + inputs=unwrap_vars(inputs), + ), + ) + .get_output_vars( + inputs=get_value(inputs), + ) + .concat_result + ) def concat_from_sequence( @@ -5291,17 +5385,21 @@ def concat_from_sequence( - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ConcatFromSequence( - _ConcatFromSequence.Attributes( - axis=AttrInt64(axis, name="axis"), - new_axis=AttrInt64(new_axis, name="new_axis"), - ), - _ConcatFromSequence.Inputs( - input_sequence=unwrap_vars(input_sequence), - ), - ).get_output_vars( - input_sequence=get_value(input_sequence), - )["concat_result"] + return ( + _ConcatFromSequence( + _ConcatFromSequence.Attributes( + axis=AttrInt64(axis, name="axis"), + new_axis=AttrInt64(new_axis, name="new_axis"), + ), + _ConcatFromSequence.Inputs( + input_sequence=unwrap_vars(input_sequence), + ), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + ) + .concat_result + ) def constant( @@ -5359,18 +5457,22 @@ def constant( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Constant( - _Constant.Attributes( - value=AttrTensor.maybe(value, name="value"), - value_float=AttrFloat32.maybe(value_float, name="value_float"), - value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), - value_int=AttrInt64.maybe(value_int, name="value_int"), - value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), - value_string=AttrString.maybe(value_string, name="value_string"), - value_strings=AttrStrings.maybe(value_strings, name="value_strings"), - ), - _Constant.Inputs(), - ).get_output_vars()["output"] + return ( + _Constant( + _Constant.Attributes( + value=AttrTensor.maybe(value, name="value"), + value_float=AttrFloat32.maybe(value_float, name="value_float"), + value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), + value_int=AttrInt64.maybe(value_int, name="value_int"), + value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), + value_string=AttrString.maybe(value_string, name="value_string"), + value_strings=AttrStrings.maybe(value_strings, name="value_strings"), + ), + _Constant.Inputs(), + ) + .get_output_vars() + .output + ) def constant_of_shape( @@ -5410,16 +5512,20 @@ def constant_of_shape( - T1: `tensor(int64)` - T2: `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ConstantOfShape( - _ConstantOfShape.Attributes( - value=AttrTensor.maybe(value, name="value"), - ), - _ConstantOfShape.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _ConstantOfShape( + _ConstantOfShape.Attributes( + value=AttrTensor.maybe(value, name="value"), + ), + _ConstantOfShape.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def conv( @@ -5519,25 +5625,29 @@ def conv( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Conv( - _Conv.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - group=AttrInt64(group, name="group"), - kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _Conv.Inputs( - X=unwrap_vars(X), - W=unwrap_vars(W), - B=unwrap_vars(B), - ), - ).get_output_vars( - X=get_value(X), - W=get_value(W), - B=get_value(B), - )["Y"] + return ( + _Conv( + _Conv.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + group=AttrInt64(group, name="group"), + kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _Conv.Inputs( + X=unwrap_vars(X), + W=unwrap_vars(W), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + X=get_value(X), + W=get_value(W), + B=get_value(B), + ) + .Y + ) def conv_integer( @@ -5648,27 +5758,31 @@ def conv_integer( - T2: `tensor(int8)`, `tensor(uint8)` - T3: `tensor(int32)` """ - return _ConvInteger( - _ConvInteger.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - group=AttrInt64(group, name="group"), - kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _ConvInteger.Inputs( - x=unwrap_vars(x), - w=unwrap_vars(w), - x_zero_point=unwrap_vars(x_zero_point), - w_zero_point=unwrap_vars(w_zero_point), - ), - ).get_output_vars( - x=get_value(x), - w=get_value(w), - x_zero_point=get_value(x_zero_point), - w_zero_point=get_value(w_zero_point), - )["y"] + return ( + _ConvInteger( + _ConvInteger.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + group=AttrInt64(group, name="group"), + kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _ConvInteger.Inputs( + x=unwrap_vars(x), + w=unwrap_vars(w), + x_zero_point=unwrap_vars(x_zero_point), + w_zero_point=unwrap_vars(w_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + w=get_value(w), + x_zero_point=get_value(x_zero_point), + w_zero_point=get_value(w_zero_point), + ) + .y + ) def conv_transpose( @@ -5799,27 +5913,31 @@ def conv_transpose( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _ConvTranspose( - _ConvTranspose.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - group=AttrInt64(group, name="group"), - kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), - output_padding=AttrInt64s.maybe(output_padding, name="output_padding"), - output_shape=AttrInt64s.maybe(output_shape, name="output_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _ConvTranspose.Inputs( - X=unwrap_vars(X), - W=unwrap_vars(W), - B=unwrap_vars(B), - ), - ).get_output_vars( - X=get_value(X), - W=get_value(W), - B=get_value(B), - )["Y"] + return ( + _ConvTranspose( + _ConvTranspose.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + group=AttrInt64(group, name="group"), + kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), + output_padding=AttrInt64s.maybe(output_padding, name="output_padding"), + output_shape=AttrInt64s.maybe(output_shape, name="output_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _ConvTranspose.Inputs( + X=unwrap_vars(X), + W=unwrap_vars(W), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + X=get_value(X), + W=get_value(W), + B=get_value(B), + ) + .Y + ) def cos( @@ -5847,14 +5965,18 @@ def cos( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Cos( - _Cos.Attributes(), - _Cos.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Cos( + _Cos.Attributes(), + _Cos.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def cosh( @@ -5882,14 +6004,18 @@ def cosh( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Cosh( - _Cosh.Attributes(), - _Cosh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Cosh( + _Cosh.Attributes(), + _Cosh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def cumsum( @@ -5957,19 +6083,23 @@ def cumsum( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` - T2: `tensor(int32)`, `tensor(int64)` """ - return _CumSum( - _CumSum.Attributes( - exclusive=AttrInt64(exclusive, name="exclusive"), - reverse=AttrInt64(reverse, name="reverse"), - ), - _CumSum.Inputs( - x=unwrap_vars(x), - axis=unwrap_vars(axis), - ), - ).get_output_vars( - x=get_value(x), - axis=get_value(axis), - )["y"] + return ( + _CumSum( + _CumSum.Attributes( + exclusive=AttrInt64(exclusive, name="exclusive"), + reverse=AttrInt64(reverse, name="reverse"), + ), + _CumSum.Inputs( + x=unwrap_vars(x), + axis=unwrap_vars(axis), + ), + ) + .get_output_vars( + x=get_value(x), + axis=get_value(axis), + ) + .y + ) def dft( @@ -6045,20 +6175,24 @@ def dft( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int32)`, `tensor(int64)` """ - return _DFT( - _DFT.Attributes( - axis=AttrInt64(axis, name="axis"), - inverse=AttrInt64(inverse, name="inverse"), - onesided=AttrInt64(onesided, name="onesided"), - ), - _DFT.Inputs( - input=unwrap_vars(input), - dft_length=unwrap_vars(dft_length), - ), - ).get_output_vars( - input=get_value(input), - dft_length=get_value(dft_length), - )["output"] + return ( + _DFT( + _DFT.Attributes( + axis=AttrInt64(axis, name="axis"), + inverse=AttrInt64(inverse, name="inverse"), + onesided=AttrInt64(onesided, name="onesided"), + ), + _DFT.Inputs( + input=unwrap_vars(input), + dft_length=unwrap_vars(dft_length), + ), + ) + .get_output_vars( + input=get_value(input), + dft_length=get_value(dft_length), + ) + .output + ) def depth_to_space( @@ -6123,17 +6257,21 @@ def depth_to_space( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _DepthToSpace( - _DepthToSpace.Attributes( - blocksize=AttrInt64(blocksize, name="blocksize"), - mode=AttrString(mode, name="mode"), - ), - _DepthToSpace.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _DepthToSpace( + _DepthToSpace.Attributes( + blocksize=AttrInt64(blocksize, name="blocksize"), + mode=AttrString(mode, name="mode"), + ), + _DepthToSpace.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def dequantize_linear( @@ -6186,20 +6324,24 @@ def dequantize_linear( Type constraints: - T: `tensor(int32)`, `tensor(int8)`, `tensor(uint8)` """ - return _DequantizeLinear( - _DequantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _DequantizeLinear.Inputs( - x=unwrap_vars(x), - x_scale=unwrap_vars(x_scale), - x_zero_point=unwrap_vars(x_zero_point), - ), - ).get_output_vars( - x=get_value(x), - x_scale=get_value(x_scale), - x_zero_point=get_value(x_zero_point), - )["y"] + return ( + _DequantizeLinear( + _DequantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _DequantizeLinear.Inputs( + x=unwrap_vars(x), + x_scale=unwrap_vars(x_scale), + x_zero_point=unwrap_vars(x_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + x_scale=get_value(x_scale), + x_zero_point=get_value(x_zero_point), + ) + .y + ) def det( @@ -6232,14 +6374,18 @@ def det( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Det( - _Det.Attributes(), - _Det.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Det( + _Det.Attributes(), + _Det.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def div( @@ -6279,16 +6425,20 @@ def div( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Div( - _Div.Attributes(), - _Div.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Div( + _Div.Attributes(), + _Div.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def dropout( @@ -6383,7 +6533,7 @@ def dropout( ratio=get_value(ratio), training_mode=get_value(training_mode), ) - .values() + ._unpack_to_any() ) @@ -6464,7 +6614,7 @@ def dynamic_quantize_linear( .get_output_vars( x=get_value(x), ) - .values() + ._unpack_to_any() ) @@ -6530,16 +6680,20 @@ def einsum( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Einsum( - _Einsum.Attributes( - equation=AttrString(equation, name="equation"), - ), - _Einsum.Inputs( - Inputs=unwrap_vars(Inputs), - ), - ).get_output_vars( - Inputs=get_value(Inputs), - )["Output"] + return ( + _Einsum( + _Einsum.Attributes( + equation=AttrString(equation, name="equation"), + ), + _Einsum.Inputs( + Inputs=unwrap_vars(Inputs), + ), + ) + .get_output_vars( + Inputs=get_value(Inputs), + ) + .Output + ) def elu( @@ -6575,16 +6729,20 @@ def elu( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Elu( - _Elu.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - ), - _Elu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Elu( + _Elu.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + ), + _Elu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def equal( @@ -6623,16 +6781,20 @@ def equal( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _Equal( - _Equal.Attributes(), - _Equal.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Equal( + _Equal.Attributes(), + _Equal.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def erf( @@ -6661,14 +6823,18 @@ def erf( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Erf( - _Erf.Attributes(), - _Erf.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Erf( + _Erf.Attributes(), + _Erf.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def exp( @@ -6696,14 +6862,18 @@ def exp( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Exp( - _Exp.Attributes(), - _Exp.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Exp( + _Exp.Attributes(), + _Exp.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def expand( @@ -6744,16 +6914,20 @@ def expand( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Expand( - _Expand.Attributes(), - _Expand.Inputs( - input=unwrap_vars(input), - shape=unwrap_vars(shape), - ), - ).get_output_vars( - input=get_value(input), - shape=get_value(shape), - )["output"] + return ( + _Expand( + _Expand.Attributes(), + _Expand.Inputs( + input=unwrap_vars(input), + shape=unwrap_vars(shape), + ), + ) + .get_output_vars( + input=get_value(input), + shape=get_value(shape), + ) + .output + ) def eye_like( @@ -6804,17 +6978,21 @@ def eye_like( - T1: `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _EyeLike( - _EyeLike.Attributes( - dtype=AttrDtype.maybe(dtype, name="dtype"), - k=AttrInt64(k, name="k"), - ), - _EyeLike.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _EyeLike( + _EyeLike.Attributes( + dtype=AttrDtype.maybe(dtype, name="dtype"), + k=AttrInt64(k, name="k"), + ), + _EyeLike.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def flatten( @@ -6856,16 +7034,20 @@ def flatten( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Flatten( - _Flatten.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Flatten.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Flatten( + _Flatten.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Flatten.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def floor( @@ -6896,14 +7078,18 @@ def floor( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Floor( - _Floor.Attributes(), - _Floor.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Floor( + _Floor.Attributes(), + _Floor.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def gru( @@ -7113,7 +7299,7 @@ def gru( sequence_lens=get_value(sequence_lens), initial_h=get_value(initial_h), ) - .values() + ._unpack_to_any() ) @@ -7203,18 +7389,22 @@ def gather( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _Gather( - _Gather.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Gather.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - )["output"] + return ( + _Gather( + _Gather.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Gather.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + ) + .output + ) def gather_elements( @@ -7311,18 +7501,22 @@ def gather_elements( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _GatherElements( - _GatherElements.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _GatherElements.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - )["output"] + return ( + _GatherElements( + _GatherElements.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _GatherElements.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + ) + .output + ) def gather_nd( @@ -7464,18 +7658,22 @@ def gather_nd( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _GatherND( - _GatherND.Attributes( - batch_dims=AttrInt64(batch_dims, name="batch_dims"), - ), - _GatherND.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - )["output"] + return ( + _GatherND( + _GatherND.Attributes( + batch_dims=AttrInt64(batch_dims, name="batch_dims"), + ), + _GatherND.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + ) + .output + ) def gemm( @@ -7551,23 +7749,27 @@ def gemm( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _Gemm( - _Gemm.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - beta=AttrFloat32(beta, name="beta"), - transA=AttrInt64(transA, name="transA"), - transB=AttrInt64(transB, name="transB"), - ), - _Gemm.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - C=unwrap_vars(C), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - C=get_value(C), - )["Y"] + return ( + _Gemm( + _Gemm.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + beta=AttrFloat32(beta, name="beta"), + transA=AttrInt64(transA, name="transA"), + transB=AttrInt64(transB, name="transB"), + ), + _Gemm.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + C=unwrap_vars(C), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + C=get_value(C), + ) + .Y + ) def global_average_pool( @@ -7604,14 +7806,18 @@ def global_average_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GlobalAveragePool( - _GlobalAveragePool.Attributes(), - _GlobalAveragePool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _GlobalAveragePool( + _GlobalAveragePool.Attributes(), + _GlobalAveragePool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def global_lp_pool( @@ -7653,16 +7859,20 @@ def global_lp_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GlobalLpPool( - _GlobalLpPool.Attributes( - p=AttrInt64(p, name="p"), - ), - _GlobalLpPool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _GlobalLpPool( + _GlobalLpPool.Attributes( + p=AttrInt64(p, name="p"), + ), + _GlobalLpPool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def global_max_pool( @@ -7699,14 +7909,18 @@ def global_max_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GlobalMaxPool( - _GlobalMaxPool.Attributes(), - _GlobalMaxPool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _GlobalMaxPool( + _GlobalMaxPool.Attributes(), + _GlobalMaxPool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def greater( @@ -7745,16 +7959,20 @@ def greater( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _Greater( - _Greater.Attributes(), - _Greater.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Greater( + _Greater.Attributes(), + _Greater.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def greater_or_equal( @@ -7793,16 +8011,20 @@ def greater_or_equal( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _GreaterOrEqual( - _GreaterOrEqual.Attributes(), - _GreaterOrEqual.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _GreaterOrEqual( + _GreaterOrEqual.Attributes(), + _GreaterOrEqual.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def grid_sample( @@ -7887,20 +8109,24 @@ def grid_sample( - T1: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GridSample( - _GridSample.Attributes( - align_corners=AttrInt64(align_corners, name="align_corners"), - mode=AttrString(mode, name="mode"), - padding_mode=AttrString(padding_mode, name="padding_mode"), - ), - _GridSample.Inputs( - X=unwrap_vars(X), - grid=unwrap_vars(grid), - ), - ).get_output_vars( - X=get_value(X), - grid=get_value(grid), - )["Y"] + return ( + _GridSample( + _GridSample.Attributes( + align_corners=AttrInt64(align_corners, name="align_corners"), + mode=AttrString(mode, name="mode"), + padding_mode=AttrString(padding_mode, name="padding_mode"), + ), + _GridSample.Inputs( + X=unwrap_vars(X), + grid=unwrap_vars(grid), + ), + ) + .get_output_vars( + X=get_value(X), + grid=get_value(grid), + ) + .Y + ) def hamming_window( @@ -7944,17 +8170,21 @@ def hamming_window( - T1: `tensor(int32)`, `tensor(int64)` - T2: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _HammingWindow( - _HammingWindow.Attributes( - output_datatype=AttrInt64(output_datatype, name="output_datatype"), - periodic=AttrInt64(periodic, name="periodic"), - ), - _HammingWindow.Inputs( - size=unwrap_vars(size), - ), - ).get_output_vars( - size=get_value(size), - )["output"] + return ( + _HammingWindow( + _HammingWindow.Attributes( + output_datatype=AttrInt64(output_datatype, name="output_datatype"), + periodic=AttrInt64(periodic, name="periodic"), + ), + _HammingWindow.Inputs( + size=unwrap_vars(size), + ), + ) + .get_output_vars( + size=get_value(size), + ) + .output + ) def hann_window( @@ -7998,17 +8228,21 @@ def hann_window( - T1: `tensor(int32)`, `tensor(int64)` - T2: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _HannWindow( - _HannWindow.Attributes( - output_datatype=AttrInt64(output_datatype, name="output_datatype"), - periodic=AttrInt64(periodic, name="periodic"), - ), - _HannWindow.Inputs( - size=unwrap_vars(size), - ), - ).get_output_vars( - size=get_value(size), - )["output"] + return ( + _HannWindow( + _HannWindow.Attributes( + output_datatype=AttrInt64(output_datatype, name="output_datatype"), + periodic=AttrInt64(periodic, name="periodic"), + ), + _HannWindow.Inputs( + size=unwrap_vars(size), + ), + ) + .get_output_vars( + size=get_value(size), + ) + .output + ) def hard_sigmoid( @@ -8047,17 +8281,21 @@ def hard_sigmoid( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _HardSigmoid( - _HardSigmoid.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - beta=AttrFloat32(beta, name="beta"), - ), - _HardSigmoid.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _HardSigmoid( + _HardSigmoid.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + beta=AttrFloat32(beta, name="beta"), + ), + _HardSigmoid.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def hard_swish( @@ -8088,14 +8326,18 @@ def hard_swish( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _HardSwish( - _HardSwish.Attributes(), - _HardSwish.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _HardSwish( + _HardSwish.Attributes(), + _HardSwish.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def hardmax( @@ -8137,16 +8379,20 @@ def hardmax( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Hardmax( - _Hardmax.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Hardmax.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Hardmax( + _Hardmax.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Hardmax.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def identity( @@ -8174,14 +8420,18 @@ def identity( Type constraints: - V: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))`, `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Identity( - _Identity.Attributes(), - _Identity.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Identity( + _Identity.Attributes(), + _Identity.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def if_( @@ -8238,18 +8488,22 @@ def if_( """ _else_branch_subgraph: Graph = subgraph((), else_branch) _then_branch_subgraph: Graph = subgraph((), then_branch) - return _If( - _If.Attributes( - else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), - then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), - ), - _If.Inputs( - cond=unwrap_vars(cond), - ), - out_variadic=len(_else_branch_subgraph.requested_results), - ).get_output_vars( - cond=get_value(cond), - )["outputs"] + return ( + _If( + _If.Attributes( + else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), + then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), + ), + _If.Inputs( + cond=unwrap_vars(cond), + ), + out_variadic=len(_else_branch_subgraph.requested_results), + ) + .get_output_vars( + cond=get_value(cond), + ) + .outputs + ) def instance_normalization( @@ -8298,20 +8552,24 @@ def instance_normalization( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _InstanceNormalization( - _InstanceNormalization.Attributes( - epsilon=AttrFloat32(epsilon, name="epsilon"), - ), - _InstanceNormalization.Inputs( - input=unwrap_vars(input), - scale=unwrap_vars(scale), - B=unwrap_vars(B), - ), - ).get_output_vars( - input=get_value(input), - scale=get_value(scale), - B=get_value(B), - )["output"] + return ( + _InstanceNormalization( + _InstanceNormalization.Attributes( + epsilon=AttrFloat32(epsilon, name="epsilon"), + ), + _InstanceNormalization.Inputs( + input=unwrap_vars(input), + scale=unwrap_vars(scale), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + input=get_value(input), + scale=get_value(scale), + B=get_value(B), + ) + .output + ) def isinf( @@ -8353,17 +8611,21 @@ def isinf( - T1: `tensor(double)`, `tensor(float)` - T2: `tensor(bool)` """ - return _IsInf( - _IsInf.Attributes( - detect_negative=AttrInt64(detect_negative, name="detect_negative"), - detect_positive=AttrInt64(detect_positive, name="detect_positive"), - ), - _IsInf.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _IsInf( + _IsInf.Attributes( + detect_negative=AttrInt64(detect_negative, name="detect_negative"), + detect_positive=AttrInt64(detect_positive, name="detect_positive"), + ), + _IsInf.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def isnan( @@ -8392,14 +8654,18 @@ def isnan( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(bool)` """ - return _IsNaN( - _IsNaN.Attributes(), - _IsNaN.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _IsNaN( + _IsNaN.Attributes(), + _IsNaN.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def lrn( @@ -8461,19 +8727,23 @@ def lrn( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LRN( - _LRN.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - beta=AttrFloat32(beta, name="beta"), - bias=AttrFloat32(bias, name="bias"), - size=AttrInt64(size, name="size"), - ), - _LRN.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LRN( + _LRN.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + beta=AttrFloat32(beta, name="beta"), + bias=AttrFloat32(bias, name="bias"), + size=AttrInt64(size, name="size"), + ), + _LRN.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def lstm( @@ -8707,7 +8977,7 @@ def lstm( initial_c=get_value(initial_c), P=get_value(P), ) - .values() + ._unpack_to_any() ) @@ -8812,7 +9082,7 @@ def layer_normalization( Scale=get_value(Scale), B=get_value(B), ) - .values() + ._unpack_to_any() ) @@ -8849,16 +9119,20 @@ def leaky_relu( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LeakyRelu( - _LeakyRelu.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - ), - _LeakyRelu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LeakyRelu( + _LeakyRelu.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + ), + _LeakyRelu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def less( @@ -8897,16 +9171,20 @@ def less( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _Less( - _Less.Attributes(), - _Less.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Less( + _Less.Attributes(), + _Less.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def less_or_equal( @@ -8945,16 +9223,20 @@ def less_or_equal( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _LessOrEqual( - _LessOrEqual.Attributes(), - _LessOrEqual.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _LessOrEqual( + _LessOrEqual.Attributes(), + _LessOrEqual.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def log( @@ -8982,14 +9264,18 @@ def log( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Log( - _Log.Attributes(), - _Log.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Log( + _Log.Attributes(), + _Log.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def log_softmax( @@ -9030,16 +9316,20 @@ def log_softmax( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LogSoftmax( - _LogSoftmax.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _LogSoftmax.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _LogSoftmax( + _LogSoftmax.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _LogSoftmax.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def loop( @@ -9223,21 +9513,25 @@ def loop( + [var.unwrap_type() for var in v_initial], body, ) - return _Loop( - _Loop.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - ), - _Loop.Inputs( - M=unwrap_vars(M), - cond=unwrap_vars(cond), - v_initial=unwrap_vars(v_initial), - ), - out_variadic=len(_body_subgraph.requested_results) - 1, - ).get_output_vars( - M=get_value(M), - cond=get_value(cond), - v_initial=get_value(v_initial), - )["v_final_and_scan_outputs"] + return ( + _Loop( + _Loop.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + ), + _Loop.Inputs( + M=unwrap_vars(M), + cond=unwrap_vars(cond), + v_initial=unwrap_vars(v_initial), + ), + out_variadic=len(_body_subgraph.requested_results) - 1, + ) + .get_output_vars( + M=get_value(M), + cond=get_value(cond), + v_initial=get_value(v_initial), + ) + .v_final_and_scan_outputs + ) def lp_normalization( @@ -9274,17 +9568,21 @@ def lp_normalization( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LpNormalization( - _LpNormalization.Attributes( - axis=AttrInt64(axis, name="axis"), - p=AttrInt64(p, name="p"), - ), - _LpNormalization.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _LpNormalization( + _LpNormalization.Attributes( + axis=AttrInt64(axis, name="axis"), + p=AttrInt64(p, name="p"), + ), + _LpNormalization.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def lp_pool( @@ -9358,20 +9656,24 @@ def lp_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LpPool( - _LpPool.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), - p=AttrInt64(p, name="p"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _LpPool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LpPool( + _LpPool.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), + p=AttrInt64(p, name="p"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _LpPool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def matmul( @@ -9404,16 +9706,20 @@ def matmul( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _MatMul( - _MatMul.Attributes(), - _MatMul.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["Y"] + return ( + _MatMul( + _MatMul.Attributes(), + _MatMul.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .Y + ) def matmul_integer( @@ -9468,20 +9774,24 @@ def matmul_integer( - T2: `tensor(int8)`, `tensor(uint8)` - T3: `tensor(int32)` """ - return _MatMulInteger( - _MatMulInteger.Attributes(), - _MatMulInteger.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - a_zero_point=unwrap_vars(a_zero_point), - b_zero_point=unwrap_vars(b_zero_point), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - a_zero_point=get_value(a_zero_point), - b_zero_point=get_value(b_zero_point), - )["Y"] + return ( + _MatMulInteger( + _MatMulInteger.Attributes(), + _MatMulInteger.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + a_zero_point=unwrap_vars(a_zero_point), + b_zero_point=unwrap_vars(b_zero_point), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + a_zero_point=get_value(a_zero_point), + b_zero_point=get_value(b_zero_point), + ) + .Y + ) def max( @@ -9513,14 +9823,18 @@ def max( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Max( - _Max.Attributes(), - _Max.Inputs( - data_0=unwrap_vars(data_0), - ), - ).get_output_vars( - data_0=get_value(data_0), - )["max"] + return ( + _Max( + _Max.Attributes(), + _Max.Inputs( + data_0=unwrap_vars(data_0), + ), + ) + .get_output_vars( + data_0=get_value(data_0), + ) + .max + ) def max_pool( @@ -9678,7 +9992,7 @@ def max_pool( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) @@ -9727,19 +10041,23 @@ def max_roi_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _MaxRoiPool( - _MaxRoiPool.Attributes( - pooled_shape=AttrInt64s(pooled_shape, name="pooled_shape"), - spatial_scale=AttrFloat32(spatial_scale, name="spatial_scale"), - ), - _MaxRoiPool.Inputs( - X=unwrap_vars(X), - rois=unwrap_vars(rois), - ), - ).get_output_vars( - X=get_value(X), - rois=get_value(rois), - )["Y"] + return ( + _MaxRoiPool( + _MaxRoiPool.Attributes( + pooled_shape=AttrInt64s(pooled_shape, name="pooled_shape"), + spatial_scale=AttrFloat32(spatial_scale, name="spatial_scale"), + ), + _MaxRoiPool.Inputs( + X=unwrap_vars(X), + rois=unwrap_vars(rois), + ), + ) + .get_output_vars( + X=get_value(X), + rois=get_value(rois), + ) + .Y + ) def max_unpool( @@ -9838,22 +10156,26 @@ def max_unpool( - T1: `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int64)` """ - return _MaxUnpool( - _MaxUnpool.Attributes( - kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _MaxUnpool.Inputs( - X=unwrap_vars(X), - I=unwrap_vars(I), - output_shape=unwrap_vars(output_shape), - ), - ).get_output_vars( - X=get_value(X), - I=get_value(I), - output_shape=get_value(output_shape), - )["output"] + return ( + _MaxUnpool( + _MaxUnpool.Attributes( + kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _MaxUnpool.Inputs( + X=unwrap_vars(X), + I=unwrap_vars(I), + output_shape=unwrap_vars(output_shape), + ), + ) + .get_output_vars( + X=get_value(X), + I=get_value(I), + output_shape=get_value(output_shape), + ) + .output + ) def mean( @@ -9885,14 +10207,18 @@ def mean( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Mean( - _Mean.Attributes(), - _Mean.Inputs( - data_0=unwrap_vars(data_0), - ), - ).get_output_vars( - data_0=get_value(data_0), - )["mean"] + return ( + _Mean( + _Mean.Attributes(), + _Mean.Inputs( + data_0=unwrap_vars(data_0), + ), + ) + .get_output_vars( + data_0=get_value(data_0), + ) + .mean + ) def mean_variance_normalization( @@ -9930,16 +10256,20 @@ def mean_variance_normalization( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _MeanVarianceNormalization( - _MeanVarianceNormalization.Attributes( - axes=AttrInt64s(axes, name="axes"), - ), - _MeanVarianceNormalization.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _MeanVarianceNormalization( + _MeanVarianceNormalization.Attributes( + axes=AttrInt64s(axes, name="axes"), + ), + _MeanVarianceNormalization.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def mel_weight_matrix( @@ -10016,24 +10346,28 @@ def mel_weight_matrix( - T2: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T3: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _MelWeightMatrix( - _MelWeightMatrix.Attributes( - output_datatype=AttrInt64(output_datatype, name="output_datatype"), - ), - _MelWeightMatrix.Inputs( - num_mel_bins=unwrap_vars(num_mel_bins), - dft_length=unwrap_vars(dft_length), - sample_rate=unwrap_vars(sample_rate), - lower_edge_hertz=unwrap_vars(lower_edge_hertz), - upper_edge_hertz=unwrap_vars(upper_edge_hertz), - ), - ).get_output_vars( - num_mel_bins=get_value(num_mel_bins), - dft_length=get_value(dft_length), - sample_rate=get_value(sample_rate), - lower_edge_hertz=get_value(lower_edge_hertz), - upper_edge_hertz=get_value(upper_edge_hertz), - )["output"] + return ( + _MelWeightMatrix( + _MelWeightMatrix.Attributes( + output_datatype=AttrInt64(output_datatype, name="output_datatype"), + ), + _MelWeightMatrix.Inputs( + num_mel_bins=unwrap_vars(num_mel_bins), + dft_length=unwrap_vars(dft_length), + sample_rate=unwrap_vars(sample_rate), + lower_edge_hertz=unwrap_vars(lower_edge_hertz), + upper_edge_hertz=unwrap_vars(upper_edge_hertz), + ), + ) + .get_output_vars( + num_mel_bins=get_value(num_mel_bins), + dft_length=get_value(dft_length), + sample_rate=get_value(sample_rate), + lower_edge_hertz=get_value(lower_edge_hertz), + upper_edge_hertz=get_value(upper_edge_hertz), + ) + .output + ) def min( @@ -10065,14 +10399,18 @@ def min( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Min( - _Min.Attributes(), - _Min.Inputs( - data_0=unwrap_vars(data_0), - ), - ).get_output_vars( - data_0=get_value(data_0), - )["min"] + return ( + _Min( + _Min.Attributes(), + _Min.Inputs( + data_0=unwrap_vars(data_0), + ), + ) + .get_output_vars( + data_0=get_value(data_0), + ) + .min + ) def mod( @@ -10127,18 +10465,22 @@ def mod( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Mod( - _Mod.Attributes( - fmod=AttrInt64(fmod, name="fmod"), - ), - _Mod.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Mod( + _Mod.Attributes( + fmod=AttrInt64(fmod, name="fmod"), + ), + _Mod.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def mul( @@ -10178,16 +10520,20 @@ def mul( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Mul( - _Mul.Attributes(), - _Mul.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Mul( + _Mul.Attributes(), + _Mul.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def multinomial( @@ -10237,18 +10583,22 @@ def multinomial( - T1: `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int32)`, `tensor(int64)` """ - return _Multinomial( - _Multinomial.Attributes( - dtype=AttrDtype(dtype, name="dtype"), - sample_size=AttrInt64(sample_size, name="sample_size"), - seed=AttrFloat32.maybe(seed, name="seed"), - ), - _Multinomial.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Multinomial( + _Multinomial.Attributes( + dtype=AttrDtype(dtype, name="dtype"), + sample_size=AttrInt64(sample_size, name="sample_size"), + seed=AttrFloat32.maybe(seed, name="seed"), + ), + _Multinomial.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def neg( @@ -10278,14 +10628,18 @@ def neg( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)` """ - return _Neg( - _Neg.Attributes(), - _Neg.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Neg( + _Neg.Attributes(), + _Neg.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def negative_log_likelihood_loss( @@ -10445,21 +10799,25 @@ def negative_log_likelihood_loss( - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _NegativeLogLikelihoodLoss( - _NegativeLogLikelihoodLoss.Attributes( - ignore_index=AttrInt64.maybe(ignore_index, name="ignore_index"), - reduction=AttrString(reduction, name="reduction"), - ), - _NegativeLogLikelihoodLoss.Inputs( - input=unwrap_vars(input), - target=unwrap_vars(target), - weight=unwrap_vars(weight), - ), - ).get_output_vars( - input=get_value(input), - target=get_value(target), - weight=get_value(weight), - )["loss"] + return ( + _NegativeLogLikelihoodLoss( + _NegativeLogLikelihoodLoss.Attributes( + ignore_index=AttrInt64.maybe(ignore_index, name="ignore_index"), + reduction=AttrString(reduction, name="reduction"), + ), + _NegativeLogLikelihoodLoss.Inputs( + input=unwrap_vars(input), + target=unwrap_vars(target), + weight=unwrap_vars(weight), + ), + ) + .get_output_vars( + input=get_value(input), + target=get_value(target), + weight=get_value(weight), + ) + .loss + ) def non_max_suppression( @@ -10528,24 +10886,28 @@ def non_max_suppression( Signature: ``ai.onnx@11::NonMaxSuppression``. """ - return _NonMaxSuppression( - _NonMaxSuppression.Attributes( - center_point_box=AttrInt64(center_point_box, name="center_point_box"), - ), - _NonMaxSuppression.Inputs( - boxes=unwrap_vars(boxes), - scores=unwrap_vars(scores), - max_output_boxes_per_class=unwrap_vars(max_output_boxes_per_class), - iou_threshold=unwrap_vars(iou_threshold), - score_threshold=unwrap_vars(score_threshold), - ), - ).get_output_vars( - boxes=get_value(boxes), - scores=get_value(scores), - max_output_boxes_per_class=get_value(max_output_boxes_per_class), - iou_threshold=get_value(iou_threshold), - score_threshold=get_value(score_threshold), - )["selected_indices"] + return ( + _NonMaxSuppression( + _NonMaxSuppression.Attributes( + center_point_box=AttrInt64(center_point_box, name="center_point_box"), + ), + _NonMaxSuppression.Inputs( + boxes=unwrap_vars(boxes), + scores=unwrap_vars(scores), + max_output_boxes_per_class=unwrap_vars(max_output_boxes_per_class), + iou_threshold=unwrap_vars(iou_threshold), + score_threshold=unwrap_vars(score_threshold), + ), + ) + .get_output_vars( + boxes=get_value(boxes), + scores=get_value(scores), + max_output_boxes_per_class=get_value(max_output_boxes_per_class), + iou_threshold=get_value(iou_threshold), + score_threshold=get_value(score_threshold), + ) + .selected_indices + ) def non_zero( @@ -10577,14 +10939,18 @@ def non_zero( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _NonZero( - _NonZero.Attributes(), - _NonZero.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _NonZero( + _NonZero.Attributes(), + _NonZero.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def not_( @@ -10612,14 +10978,18 @@ def not_( Type constraints: - T: `tensor(bool)` """ - return _Not( - _Not.Attributes(), - _Not.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Not( + _Not.Attributes(), + _Not.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def one_hot( @@ -10703,20 +11073,24 @@ def one_hot( - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T3: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _OneHot( - _OneHot.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _OneHot.Inputs( - indices=unwrap_vars(indices), - depth=unwrap_vars(depth), - values=unwrap_vars(values), - ), - ).get_output_vars( - indices=get_value(indices), - depth=get_value(depth), - values=get_value(values), - )["output"] + return ( + _OneHot( + _OneHot.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _OneHot.Inputs( + indices=unwrap_vars(indices), + depth=unwrap_vars(depth), + values=unwrap_vars(values), + ), + ) + .get_output_vars( + indices=get_value(indices), + depth=get_value(depth), + values=get_value(values), + ) + .output + ) def optional( @@ -10752,16 +11126,20 @@ def optional( - V: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - O: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))` """ - return _Optional( - _Optional.Attributes( - type=AttrType.maybe(type, name="type"), - ), - _Optional.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Optional( + _Optional.Attributes( + type=AttrType.maybe(type, name="type"), + ), + _Optional.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def optional_get_element( @@ -10792,14 +11170,18 @@ def optional_get_element( - O: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))` - V: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _OptionalGetElement( - _OptionalGetElement.Attributes(), - _OptionalGetElement.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _OptionalGetElement( + _OptionalGetElement.Attributes(), + _OptionalGetElement.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def optional_has_element( @@ -10830,14 +11212,18 @@ def optional_has_element( - O: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))` - B: `tensor(bool)` """ - return _OptionalHasElement( - _OptionalHasElement.Attributes(), - _OptionalHasElement.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _OptionalHasElement( + _OptionalHasElement.Attributes(), + _OptionalHasElement.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def or_( @@ -10876,16 +11262,20 @@ def or_( - T: `tensor(bool)` - T1: `tensor(bool)` """ - return _Or( - _Or.Attributes(), - _Or.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Or( + _Or.Attributes(), + _Or.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def prelu( @@ -10924,16 +11314,20 @@ def prelu( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _PRelu( - _PRelu.Attributes(), - _PRelu.Inputs( - X=unwrap_vars(X), - slope=unwrap_vars(slope), - ), - ).get_output_vars( - X=get_value(X), - slope=get_value(slope), - )["Y"] + return ( + _PRelu( + _PRelu.Attributes(), + _PRelu.Inputs( + X=unwrap_vars(X), + slope=unwrap_vars(slope), + ), + ) + .get_output_vars( + X=get_value(X), + slope=get_value(slope), + ) + .Y + ) def pad( @@ -11030,20 +11424,24 @@ def pad( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Pad( - _Pad.Attributes( - mode=AttrString(mode, name="mode"), - ), - _Pad.Inputs( - data=unwrap_vars(data), - pads=unwrap_vars(pads), - constant_value=unwrap_vars(constant_value), - ), - ).get_output_vars( - data=get_value(data), - pads=get_value(pads), - constant_value=get_value(constant_value), - )["output"] + return ( + _Pad( + _Pad.Attributes( + mode=AttrString(mode, name="mode"), + ), + _Pad.Inputs( + data=unwrap_vars(data), + pads=unwrap_vars(pads), + constant_value=unwrap_vars(constant_value), + ), + ) + .get_output_vars( + data=get_value(data), + pads=get_value(pads), + constant_value=get_value(constant_value), + ) + .output + ) def pow( @@ -11081,16 +11479,20 @@ def pow( - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)` - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Pow( - _Pow.Attributes(), - _Pow.Inputs( - X=unwrap_vars(X), - Y=unwrap_vars(Y), - ), - ).get_output_vars( - X=get_value(X), - Y=get_value(Y), - )["Z"] + return ( + _Pow( + _Pow.Attributes(), + _Pow.Inputs( + X=unwrap_vars(X), + Y=unwrap_vars(Y), + ), + ) + .get_output_vars( + X=get_value(X), + Y=get_value(Y), + ) + .Z + ) def qlinear_conv( @@ -11233,37 +11635,41 @@ def qlinear_conv( - T3: `tensor(int8)`, `tensor(uint8)` - T4: `tensor(int32)` """ - return _QLinearConv( - _QLinearConv.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - group=AttrInt64(group, name="group"), - kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _QLinearConv.Inputs( - x=unwrap_vars(x), - x_scale=unwrap_vars(x_scale), - x_zero_point=unwrap_vars(x_zero_point), - w=unwrap_vars(w), - w_scale=unwrap_vars(w_scale), - w_zero_point=unwrap_vars(w_zero_point), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - B=unwrap_vars(B), - ), - ).get_output_vars( - x=get_value(x), - x_scale=get_value(x_scale), - x_zero_point=get_value(x_zero_point), - w=get_value(w), - w_scale=get_value(w_scale), - w_zero_point=get_value(w_zero_point), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - B=get_value(B), - )["y"] + return ( + _QLinearConv( + _QLinearConv.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + group=AttrInt64(group, name="group"), + kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _QLinearConv.Inputs( + x=unwrap_vars(x), + x_scale=unwrap_vars(x_scale), + x_zero_point=unwrap_vars(x_zero_point), + w=unwrap_vars(w), + w_scale=unwrap_vars(w_scale), + w_zero_point=unwrap_vars(w_zero_point), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + x=get_value(x), + x_scale=get_value(x_scale), + x_zero_point=get_value(x_zero_point), + w=get_value(w), + w_scale=get_value(w_scale), + w_zero_point=get_value(w_zero_point), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + B=get_value(B), + ) + .y + ) def qlinear_matmul( @@ -11338,28 +11744,32 @@ def qlinear_matmul( - T2: `tensor(int8)`, `tensor(uint8)` - T3: `tensor(int8)`, `tensor(uint8)` """ - return _QLinearMatMul( - _QLinearMatMul.Attributes(), - _QLinearMatMul.Inputs( - a=unwrap_vars(a), - a_scale=unwrap_vars(a_scale), - a_zero_point=unwrap_vars(a_zero_point), - b=unwrap_vars(b), - b_scale=unwrap_vars(b_scale), - b_zero_point=unwrap_vars(b_zero_point), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - ), - ).get_output_vars( - a=get_value(a), - a_scale=get_value(a_scale), - a_zero_point=get_value(a_zero_point), - b=get_value(b), - b_scale=get_value(b_scale), - b_zero_point=get_value(b_zero_point), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - )["y"] + return ( + _QLinearMatMul( + _QLinearMatMul.Attributes(), + _QLinearMatMul.Inputs( + a=unwrap_vars(a), + a_scale=unwrap_vars(a_scale), + a_zero_point=unwrap_vars(a_zero_point), + b=unwrap_vars(b), + b_scale=unwrap_vars(b_scale), + b_zero_point=unwrap_vars(b_zero_point), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + ), + ) + .get_output_vars( + a=get_value(a), + a_scale=get_value(a_scale), + a_zero_point=get_value(a_zero_point), + b=get_value(b), + b_scale=get_value(b_scale), + b_zero_point=get_value(b_zero_point), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + ) + .y + ) def quantize_linear( @@ -11416,20 +11826,24 @@ def quantize_linear( - T1: `tensor(float)`, `tensor(int32)` - T2: `tensor(int8)`, `tensor(uint8)` """ - return _QuantizeLinear( - _QuantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _QuantizeLinear.Inputs( - x=unwrap_vars(x), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - ), - ).get_output_vars( - x=get_value(x), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - )["y"] + return ( + _QuantizeLinear( + _QuantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _QuantizeLinear.Inputs( + x=unwrap_vars(x), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + ) + .y + ) def rnn( @@ -11616,7 +12030,7 @@ def rnn( sequence_lens=get_value(sequence_lens), initial_h=get_value(initial_h), ) - .values() + ._unpack_to_any() ) @@ -11671,16 +12085,20 @@ def random_normal( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _RandomNormal( - _RandomNormal.Attributes( - dtype=AttrDtype(dtype, name="dtype"), - mean=AttrFloat32(mean, name="mean"), - scale=AttrFloat32(scale, name="scale"), - seed=AttrFloat32.maybe(seed, name="seed"), - shape=AttrInt64s(shape, name="shape"), - ), - _RandomNormal.Inputs(), - ).get_output_vars()["output"] + return ( + _RandomNormal( + _RandomNormal.Attributes( + dtype=AttrDtype(dtype, name="dtype"), + mean=AttrFloat32(mean, name="mean"), + scale=AttrFloat32(scale, name="scale"), + seed=AttrFloat32.maybe(seed, name="seed"), + shape=AttrInt64s(shape, name="shape"), + ), + _RandomNormal.Inputs(), + ) + .get_output_vars() + .output + ) def random_normal_like( @@ -11736,19 +12154,23 @@ def random_normal_like( - T1: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _RandomNormalLike( - _RandomNormalLike.Attributes( - dtype=AttrDtype.maybe(dtype, name="dtype"), - mean=AttrFloat32(mean, name="mean"), - scale=AttrFloat32(scale, name="scale"), - seed=AttrFloat32.maybe(seed, name="seed"), - ), - _RandomNormalLike.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _RandomNormalLike( + _RandomNormalLike.Attributes( + dtype=AttrDtype.maybe(dtype, name="dtype"), + mean=AttrFloat32(mean, name="mean"), + scale=AttrFloat32(scale, name="scale"), + seed=AttrFloat32.maybe(seed, name="seed"), + ), + _RandomNormalLike.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def random_uniform( @@ -11801,16 +12223,20 @@ def random_uniform( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _RandomUniform( - _RandomUniform.Attributes( - dtype=AttrDtype(dtype, name="dtype"), - high=AttrFloat32(high, name="high"), - low=AttrFloat32(low, name="low"), - seed=AttrFloat32.maybe(seed, name="seed"), - shape=AttrInt64s(shape, name="shape"), - ), - _RandomUniform.Inputs(), - ).get_output_vars()["output"] + return ( + _RandomUniform( + _RandomUniform.Attributes( + dtype=AttrDtype(dtype, name="dtype"), + high=AttrFloat32(high, name="high"), + low=AttrFloat32(low, name="low"), + seed=AttrFloat32.maybe(seed, name="seed"), + shape=AttrInt64s(shape, name="shape"), + ), + _RandomUniform.Inputs(), + ) + .get_output_vars() + .output + ) def random_uniform_like( @@ -11866,19 +12292,23 @@ def random_uniform_like( - T1: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _RandomUniformLike( - _RandomUniformLike.Attributes( - dtype=AttrDtype.maybe(dtype, name="dtype"), - high=AttrFloat32(high, name="high"), - low=AttrFloat32(low, name="low"), - seed=AttrFloat32.maybe(seed, name="seed"), - ), - _RandomUniformLike.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _RandomUniformLike( + _RandomUniformLike.Attributes( + dtype=AttrDtype.maybe(dtype, name="dtype"), + high=AttrFloat32(high, name="high"), + low=AttrFloat32(low, name="low"), + seed=AttrFloat32.maybe(seed, name="seed"), + ), + _RandomUniformLike.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def range( @@ -11945,18 +12375,22 @@ def range( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)` """ - return _Range( - _Range.Attributes(), - _Range.Inputs( - start=unwrap_vars(start), - limit=unwrap_vars(limit), - delta=unwrap_vars(delta), - ), - ).get_output_vars( - start=get_value(start), - limit=get_value(limit), - delta=get_value(delta), - )["output"] + return ( + _Range( + _Range.Attributes(), + _Range.Inputs( + start=unwrap_vars(start), + limit=unwrap_vars(limit), + delta=unwrap_vars(delta), + ), + ) + .get_output_vars( + start=get_value(start), + limit=get_value(limit), + delta=get_value(delta), + ) + .output + ) def reciprocal( @@ -11986,14 +12420,18 @@ def reciprocal( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Reciprocal( - _Reciprocal.Attributes(), - _Reciprocal.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Reciprocal( + _Reciprocal.Attributes(), + _Reciprocal.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def reduce_l1( @@ -12040,17 +12478,21 @@ def reduce_l1( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceL1( - _ReduceL1.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceL1.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceL1( + _ReduceL1.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceL1.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_l2( @@ -12097,17 +12539,21 @@ def reduce_l2( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceL2( - _ReduceL2.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceL2.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceL2( + _ReduceL2.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceL2.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_log_sum( @@ -12155,17 +12601,21 @@ def reduce_log_sum( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceLogSum( - _ReduceLogSum.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceLogSum.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceLogSum( + _ReduceLogSum.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceLogSum.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_log_sum_exp( @@ -12213,17 +12663,21 @@ def reduce_log_sum_exp( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceLogSumExp( - _ReduceLogSumExp.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceLogSumExp.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceLogSumExp( + _ReduceLogSumExp.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceLogSumExp.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_max( @@ -12272,17 +12726,21 @@ def reduce_max( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMax( - _ReduceMax.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceMax.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceMax( + _ReduceMax.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceMax.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_mean( @@ -12329,17 +12787,21 @@ def reduce_mean( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceMean( - _ReduceMean.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceMean.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceMean( + _ReduceMean.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceMean.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_min( @@ -12387,17 +12849,21 @@ def reduce_min( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMin( - _ReduceMin.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceMin.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceMin( + _ReduceMin.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceMin.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_prod( @@ -12444,17 +12910,21 @@ def reduce_prod( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceProd( - _ReduceProd.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceProd.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceProd( + _ReduceProd.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceProd.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def reduce_sum( @@ -12510,21 +12980,25 @@ def reduce_sum( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceSum( - _ReduceSum.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" - ), - ), - _ReduceSum.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + return ( + _ReduceSum( + _ReduceSum.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceSum.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_sum_square( @@ -12571,17 +13045,21 @@ def reduce_sum_square( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceSumSquare( - _ReduceSumSquare.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _ReduceSumSquare.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["reduced"] + return ( + _ReduceSumSquare( + _ReduceSumSquare.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _ReduceSumSquare.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .reduced + ) def relu( @@ -12611,14 +13089,18 @@ def relu( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)` """ - return _Relu( - _Relu.Attributes(), - _Relu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Relu( + _Relu.Attributes(), + _Relu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def reshape( @@ -12672,18 +13154,22 @@ def reshape( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Reshape( - _Reshape.Attributes( - allowzero=AttrInt64(allowzero, name="allowzero"), - ), - _Reshape.Inputs( - data=unwrap_vars(data), - shape=unwrap_vars(shape), - ), - ).get_output_vars( - data=get_value(data), - shape=get_value(shape), - )["reshaped"] + return ( + _Reshape( + _Reshape.Attributes( + allowzero=AttrInt64(allowzero, name="allowzero"), + ), + _Reshape.Inputs( + data=unwrap_vars(data), + shape=unwrap_vars(shape), + ), + ) + .get_output_vars( + data=get_value(data), + shape=get_value(shape), + ) + .reshaped + ) def resize( @@ -12805,31 +13291,36 @@ def resize( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Resize( - _Resize.Attributes( - coordinate_transformation_mode=AttrString( - coordinate_transformation_mode, name="coordinate_transformation_mode" - ), - cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), - exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), - extrapolation_value=AttrFloat32( - extrapolation_value, name="extrapolation_value" - ), - mode=AttrString(mode, name="mode"), - nearest_mode=AttrString(nearest_mode, name="nearest_mode"), - ), - _Resize.Inputs( - X=unwrap_vars(X), - roi=unwrap_vars(roi), - scales=unwrap_vars(scales), - sizes=unwrap_vars(sizes), - ), - ).get_output_vars( - X=get_value(X), - roi=get_value(roi), - scales=get_value(scales), - sizes=get_value(sizes), - )["Y"] + return ( + _Resize( + _Resize.Attributes( + coordinate_transformation_mode=AttrString( + coordinate_transformation_mode, + name="coordinate_transformation_mode", + ), + cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), + exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), + extrapolation_value=AttrFloat32( + extrapolation_value, name="extrapolation_value" + ), + mode=AttrString(mode, name="mode"), + nearest_mode=AttrString(nearest_mode, name="nearest_mode"), + ), + _Resize.Inputs( + X=unwrap_vars(X), + roi=unwrap_vars(roi), + scales=unwrap_vars(scales), + sizes=unwrap_vars(sizes), + ), + ) + .get_output_vars( + X=get_value(X), + roi=get_value(roi), + scales=get_value(scales), + sizes=get_value(sizes), + ) + .Y + ) def reverse_sequence( @@ -12894,19 +13385,23 @@ def reverse_sequence( Type constraints: - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReverseSequence( - _ReverseSequence.Attributes( - batch_axis=AttrInt64(batch_axis, name="batch_axis"), - time_axis=AttrInt64(time_axis, name="time_axis"), - ), - _ReverseSequence.Inputs( - input=unwrap_vars(input), - sequence_lens=unwrap_vars(sequence_lens), - ), - ).get_output_vars( - input=get_value(input), - sequence_lens=get_value(sequence_lens), - )["Y"] + return ( + _ReverseSequence( + _ReverseSequence.Attributes( + batch_axis=AttrInt64(batch_axis, name="batch_axis"), + time_axis=AttrInt64(time_axis, name="time_axis"), + ), + _ReverseSequence.Inputs( + input=unwrap_vars(input), + sequence_lens=unwrap_vars(sequence_lens), + ), + ) + .get_output_vars( + input=get_value(input), + sequence_lens=get_value(sequence_lens), + ) + .Y + ) def roi_align( @@ -12996,27 +13491,32 @@ def roi_align( - T1: `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int64)` """ - return _RoiAlign( - _RoiAlign.Attributes( - coordinate_transformation_mode=AttrString( - coordinate_transformation_mode, name="coordinate_transformation_mode" - ), - mode=AttrString(mode, name="mode"), - output_height=AttrInt64(output_height, name="output_height"), - output_width=AttrInt64(output_width, name="output_width"), - sampling_ratio=AttrInt64(sampling_ratio, name="sampling_ratio"), - spatial_scale=AttrFloat32(spatial_scale, name="spatial_scale"), - ), - _RoiAlign.Inputs( - X=unwrap_vars(X), - rois=unwrap_vars(rois), - batch_indices=unwrap_vars(batch_indices), - ), - ).get_output_vars( - X=get_value(X), - rois=get_value(rois), - batch_indices=get_value(batch_indices), - )["Y"] + return ( + _RoiAlign( + _RoiAlign.Attributes( + coordinate_transformation_mode=AttrString( + coordinate_transformation_mode, + name="coordinate_transformation_mode", + ), + mode=AttrString(mode, name="mode"), + output_height=AttrInt64(output_height, name="output_height"), + output_width=AttrInt64(output_width, name="output_width"), + sampling_ratio=AttrInt64(sampling_ratio, name="sampling_ratio"), + spatial_scale=AttrFloat32(spatial_scale, name="spatial_scale"), + ), + _RoiAlign.Inputs( + X=unwrap_vars(X), + rois=unwrap_vars(rois), + batch_indices=unwrap_vars(batch_indices), + ), + ) + .get_output_vars( + X=get_value(X), + rois=get_value(rois), + batch_indices=get_value(batch_indices), + ) + .Y + ) def round( @@ -13058,14 +13558,18 @@ def round( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Round( - _Round.Attributes(), - _Round.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Round( + _Round.Attributes(), + _Round.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def stft( @@ -13129,22 +13633,26 @@ def stft( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int32)`, `tensor(int64)` """ - return _STFT( - _STFT.Attributes( - onesided=AttrInt64(onesided, name="onesided"), - ), - _STFT.Inputs( - signal=unwrap_vars(signal), - frame_step=unwrap_vars(frame_step), - window=unwrap_vars(window), - frame_length=unwrap_vars(frame_length), - ), - ).get_output_vars( - signal=get_value(signal), - frame_step=get_value(frame_step), - window=get_value(window), - frame_length=get_value(frame_length), - )["output"] + return ( + _STFT( + _STFT.Attributes( + onesided=AttrInt64(onesided, name="onesided"), + ), + _STFT.Inputs( + signal=unwrap_vars(signal), + frame_step=unwrap_vars(frame_step), + window=unwrap_vars(window), + frame_length=unwrap_vars(frame_length), + ), + ) + .get_output_vars( + signal=get_value(signal), + frame_step=get_value(frame_step), + window=get_value(window), + frame_length=get_value(frame_length), + ) + .output + ) def scan( @@ -13368,28 +13876,36 @@ def scan( ], body, ) - return _Scan( - _Scan.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), - scan_input_axes=AttrInt64s.maybe(scan_input_axes, name="scan_input_axes"), - scan_input_directions=AttrInt64s.maybe( - scan_input_directions, name="scan_input_directions" - ), - scan_output_axes=AttrInt64s.maybe( - scan_output_axes, name="scan_output_axes" - ), - scan_output_directions=AttrInt64s.maybe( - scan_output_directions, name="scan_output_directions" - ), - ), - _Scan.Inputs( - initial_state_and_scan_inputs=unwrap_vars(initial_state_and_scan_inputs), - ), - out_variadic=len(_body_subgraph.requested_results), - ).get_output_vars( - initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), - )["final_state_and_scan_outputs"] + return ( + _Scan( + _Scan.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), + scan_input_axes=AttrInt64s.maybe( + scan_input_axes, name="scan_input_axes" + ), + scan_input_directions=AttrInt64s.maybe( + scan_input_directions, name="scan_input_directions" + ), + scan_output_axes=AttrInt64s.maybe( + scan_output_axes, name="scan_output_axes" + ), + scan_output_directions=AttrInt64s.maybe( + scan_output_directions, name="scan_output_directions" + ), + ), + _Scan.Inputs( + initial_state_and_scan_inputs=unwrap_vars( + initial_state_and_scan_inputs + ), + ), + out_variadic=len(_body_subgraph.requested_results), + ) + .get_output_vars( + initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), + ) + .final_state_and_scan_outputs + ) def scatter_elements( @@ -13512,21 +14028,25 @@ def scatter_elements( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _ScatterElements( - _ScatterElements.Attributes( - axis=AttrInt64(axis, name="axis"), - reduction=AttrString(reduction, name="reduction"), - ), - _ScatterElements.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - updates=unwrap_vars(updates), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - updates=get_value(updates), - )["output"] + return ( + _ScatterElements( + _ScatterElements.Attributes( + axis=AttrInt64(axis, name="axis"), + reduction=AttrString(reduction, name="reduction"), + ), + _ScatterElements.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + updates=unwrap_vars(updates), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + updates=get_value(updates), + ) + .output + ) def scatter_nd( @@ -13638,20 +14158,24 @@ def scatter_nd( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ScatterND( - _ScatterND.Attributes( - reduction=AttrString(reduction, name="reduction"), - ), - _ScatterND.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - updates=unwrap_vars(updates), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - updates=get_value(updates), - )["output"] + return ( + _ScatterND( + _ScatterND.Attributes( + reduction=AttrString(reduction, name="reduction"), + ), + _ScatterND.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + updates=unwrap_vars(updates), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + updates=get_value(updates), + ) + .output + ) def selu( @@ -13693,17 +14217,21 @@ def selu( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Selu( - _Selu.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - gamma=AttrFloat32(gamma, name="gamma"), - ), - _Selu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Selu( + _Selu.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + gamma=AttrFloat32(gamma, name="gamma"), + ), + _Selu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def sequence_at( @@ -13744,16 +14272,20 @@ def sequence_at( - I: `tensor(int32)`, `tensor(int64)` - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _SequenceAt( - _SequenceAt.Attributes(), - _SequenceAt.Inputs( - input_sequence=unwrap_vars(input_sequence), - position=unwrap_vars(position), - ), - ).get_output_vars( - input_sequence=get_value(input_sequence), - position=get_value(position), - )["tensor"] + return ( + _SequenceAt( + _SequenceAt.Attributes(), + _SequenceAt.Inputs( + input_sequence=unwrap_vars(input_sequence), + position=unwrap_vars(position), + ), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + position=get_value(position), + ) + .tensor + ) def sequence_construct( @@ -13783,14 +14315,18 @@ def sequence_construct( - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` """ - return _SequenceConstruct( - _SequenceConstruct.Attributes(), - _SequenceConstruct.Inputs( - inputs=unwrap_vars(inputs), - ), - ).get_output_vars( - inputs=get_value(inputs), - )["output_sequence"] + return ( + _SequenceConstruct( + _SequenceConstruct.Attributes(), + _SequenceConstruct.Inputs( + inputs=unwrap_vars(inputs), + ), + ) + .get_output_vars( + inputs=get_value(inputs), + ) + .output_sequence + ) def sequence_empty( @@ -13820,12 +14356,16 @@ def sequence_empty( Type constraints: - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` """ - return _SequenceEmpty( - _SequenceEmpty.Attributes( - dtype=AttrDtype.maybe(dtype, name="dtype"), - ), - _SequenceEmpty.Inputs(), - ).get_output_vars()["output"] + return ( + _SequenceEmpty( + _SequenceEmpty.Attributes( + dtype=AttrDtype.maybe(dtype, name="dtype"), + ), + _SequenceEmpty.Inputs(), + ) + .get_output_vars() + .output + ) def sequence_erase( @@ -13866,16 +14406,20 @@ def sequence_erase( - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` - I: `tensor(int32)`, `tensor(int64)` """ - return _SequenceErase( - _SequenceErase.Attributes(), - _SequenceErase.Inputs( - input_sequence=unwrap_vars(input_sequence), - position=unwrap_vars(position), - ), - ).get_output_vars( - input_sequence=get_value(input_sequence), - position=get_value(position), - )["output_sequence"] + return ( + _SequenceErase( + _SequenceErase.Attributes(), + _SequenceErase.Inputs( + input_sequence=unwrap_vars(input_sequence), + position=unwrap_vars(position), + ), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + position=get_value(position), + ) + .output_sequence + ) def sequence_insert( @@ -13923,18 +14467,22 @@ def sequence_insert( - T: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - I: `tensor(int32)`, `tensor(int64)` """ - return _SequenceInsert( - _SequenceInsert.Attributes(), - _SequenceInsert.Inputs( - input_sequence=unwrap_vars(input_sequence), - tensor=unwrap_vars(tensor), - position=unwrap_vars(position), - ), - ).get_output_vars( - input_sequence=get_value(input_sequence), - tensor=get_value(tensor), - position=get_value(position), - )["output_sequence"] + return ( + _SequenceInsert( + _SequenceInsert.Attributes(), + _SequenceInsert.Inputs( + input_sequence=unwrap_vars(input_sequence), + tensor=unwrap_vars(tensor), + position=unwrap_vars(position), + ), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + tensor=get_value(tensor), + position=get_value(position), + ) + .output_sequence + ) def sequence_length( @@ -13964,14 +14512,18 @@ def sequence_length( - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` - I: `tensor(int64)` """ - return _SequenceLength( - _SequenceLength.Attributes(), - _SequenceLength.Inputs( - input_sequence=unwrap_vars(input_sequence), - ), - ).get_output_vars( - input_sequence=get_value(input_sequence), - )["length"] + return ( + _SequenceLength( + _SequenceLength.Attributes(), + _SequenceLength.Inputs( + input_sequence=unwrap_vars(input_sequence), + ), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + ) + .length + ) def sequence_map( @@ -14034,19 +14586,23 @@ def sequence_map( ], body, ) - return _SequenceMap( - _SequenceMap.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - ), - _SequenceMap.Inputs( - input_sequence=unwrap_vars(input_sequence), - additional_inputs=unwrap_vars(additional_inputs), - ), - out_variadic=len(_body_subgraph.requested_results), - ).get_output_vars( - input_sequence=get_value(input_sequence), - additional_inputs=get_value(additional_inputs), - )["out_sequence"] + return ( + _SequenceMap( + _SequenceMap.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + ), + _SequenceMap.Inputs( + input_sequence=unwrap_vars(input_sequence), + additional_inputs=unwrap_vars(additional_inputs), + ), + out_variadic=len(_body_subgraph.requested_results), + ) + .get_output_vars( + input_sequence=get_value(input_sequence), + additional_inputs=get_value(additional_inputs), + ) + .out_sequence + ) def shape( @@ -14125,17 +14681,21 @@ def shape( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Shape( - _Shape.Attributes( - end=AttrInt64.maybe(end, name="end"), - start=AttrInt64(start, name="start"), - ), - _Shape.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["shape"] + return ( + _Shape( + _Shape.Attributes( + end=AttrInt64.maybe(end, name="end"), + start=AttrInt64(start, name="start"), + ), + _Shape.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .shape + ) def shrink( @@ -14175,17 +14735,21 @@ def shrink( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Shrink( - _Shrink.Attributes( - bias=AttrFloat32(bias, name="bias"), - lambd=AttrFloat32(lambd, name="lambd"), - ), - _Shrink.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Shrink( + _Shrink.Attributes( + bias=AttrFloat32(bias, name="bias"), + lambd=AttrFloat32(lambd, name="lambd"), + ), + _Shrink.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def sigmoid( @@ -14215,14 +14779,18 @@ def sigmoid( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Sigmoid( - _Sigmoid.Attributes(), - _Sigmoid.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Sigmoid( + _Sigmoid.Attributes(), + _Sigmoid.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def sign( @@ -14252,14 +14820,18 @@ def sign( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Sign( - _Sign.Attributes(), - _Sign.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Sign( + _Sign.Attributes(), + _Sign.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def sin( @@ -14287,14 +14859,18 @@ def sin( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Sin( - _Sin.Attributes(), - _Sin.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Sin( + _Sin.Attributes(), + _Sin.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def sinh( @@ -14322,14 +14898,18 @@ def sinh( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Sinh( - _Sinh.Attributes(), - _Sinh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Sinh( + _Sinh.Attributes(), + _Sinh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def size( @@ -14359,14 +14939,18 @@ def size( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Size( - _Size.Attributes(), - _Size.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["size"] + return ( + _Size( + _Size.Attributes(), + _Size.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .size + ) def slice( @@ -14482,22 +15066,26 @@ def slice( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _Slice( - _Slice.Attributes(), - _Slice.Inputs( - data=unwrap_vars(data), - starts=unwrap_vars(starts), - ends=unwrap_vars(ends), - axes=unwrap_vars(axes), - steps=unwrap_vars(steps), - ), - ).get_output_vars( - data=get_value(data), - starts=get_value(starts), - ends=get_value(ends), - axes=get_value(axes), - steps=get_value(steps), - )["output"] + return ( + _Slice( + _Slice.Attributes(), + _Slice.Inputs( + data=unwrap_vars(data), + starts=unwrap_vars(starts), + ends=unwrap_vars(ends), + axes=unwrap_vars(axes), + steps=unwrap_vars(steps), + ), + ) + .get_output_vars( + data=get_value(data), + starts=get_value(starts), + ends=get_value(ends), + axes=get_value(axes), + steps=get_value(steps), + ) + .output + ) def softmax( @@ -14540,16 +15128,20 @@ def softmax( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Softmax( - _Softmax.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Softmax.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Softmax( + _Softmax.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Softmax.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def softmax_cross_entropy_loss( @@ -14678,7 +15270,7 @@ def softmax_cross_entropy_loss( labels=get_value(labels), weights=get_value(weights), ) - .values() + ._unpack_to_any() ) @@ -14709,14 +15301,18 @@ def softplus( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Softplus( - _Softplus.Attributes(), - _Softplus.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Softplus( + _Softplus.Attributes(), + _Softplus.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def softsign( @@ -14746,14 +15342,18 @@ def softsign( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Softsign( - _Softsign.Attributes(), - _Softsign.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Softsign( + _Softsign.Attributes(), + _Softsign.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def space_to_depth( @@ -14790,16 +15390,20 @@ def space_to_depth( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _SpaceToDepth( - _SpaceToDepth.Attributes( - blocksize=AttrInt64(blocksize, name="blocksize"), - ), - _SpaceToDepth.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _SpaceToDepth( + _SpaceToDepth.Attributes( + blocksize=AttrInt64(blocksize, name="blocksize"), + ), + _SpaceToDepth.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def split( @@ -14844,19 +15448,23 @@ def split( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Split( - _Split.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Split.Inputs( - input=unwrap_vars(input), - split=unwrap_vars(split), - ), - out_variadic=outputs_count, - ).get_output_vars( - input=get_value(input), - split=get_value(split), - )["outputs"] + return ( + _Split( + _Split.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Split.Inputs( + input=unwrap_vars(input), + split=unwrap_vars(split), + ), + out_variadic=outputs_count, + ) + .get_output_vars( + input=get_value(input), + split=get_value(split), + ) + .outputs + ) def split_to_sequence( @@ -14914,19 +15522,23 @@ def split_to_sequence( - I: `tensor(int32)`, `tensor(int64)` - S: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))` """ - return _SplitToSequence( - _SplitToSequence.Attributes( - axis=AttrInt64(axis, name="axis"), - keepdims=AttrInt64(keepdims, name="keepdims"), - ), - _SplitToSequence.Inputs( - input=unwrap_vars(input), - split=unwrap_vars(split), - ), - ).get_output_vars( - input=get_value(input), - split=get_value(split), - )["output_sequence"] + return ( + _SplitToSequence( + _SplitToSequence.Attributes( + axis=AttrInt64(axis, name="axis"), + keepdims=AttrInt64(keepdims, name="keepdims"), + ), + _SplitToSequence.Inputs( + input=unwrap_vars(input), + split=unwrap_vars(split), + ), + ) + .get_output_vars( + input=get_value(input), + split=get_value(split), + ) + .output_sequence + ) def sqrt( @@ -14956,14 +15568,18 @@ def sqrt( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Sqrt( - _Sqrt.Attributes(), - _Sqrt.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Sqrt( + _Sqrt.Attributes(), + _Sqrt.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def squeeze( @@ -15001,16 +15617,20 @@ def squeeze( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Squeeze( - _Squeeze.Attributes(), - _Squeeze.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["squeezed"] + return ( + _Squeeze( + _Squeeze.Attributes(), + _Squeeze.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .squeezed + ) def string_normalizer( @@ -15065,21 +15685,27 @@ def string_normalizer( Signature: ``ai.onnx@10::StringNormalizer``. """ - return _StringNormalizer( - _StringNormalizer.Attributes( - case_change_action=AttrString( - case_change_action, name="case_change_action" - ), - is_case_sensitive=AttrInt64(is_case_sensitive, name="is_case_sensitive"), - locale=AttrString.maybe(locale, name="locale"), - stopwords=AttrStrings.maybe(stopwords, name="stopwords"), - ), - _StringNormalizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _StringNormalizer( + _StringNormalizer.Attributes( + case_change_action=AttrString( + case_change_action, name="case_change_action" + ), + is_case_sensitive=AttrInt64( + is_case_sensitive, name="is_case_sensitive" + ), + locale=AttrString.maybe(locale, name="locale"), + stopwords=AttrStrings.maybe(stopwords, name="stopwords"), + ), + _StringNormalizer.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def sub( @@ -15119,16 +15745,20 @@ def sub( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Sub( - _Sub.Attributes(), - _Sub.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Sub( + _Sub.Attributes(), + _Sub.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def sum( @@ -15160,14 +15790,18 @@ def sum( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Sum( - _Sum.Attributes(), - _Sum.Inputs( - data_0=unwrap_vars(data_0), - ), - ).get_output_vars( - data_0=get_value(data_0), - )["sum"] + return ( + _Sum( + _Sum.Attributes(), + _Sum.Inputs( + data_0=unwrap_vars(data_0), + ), + ) + .get_output_vars( + data_0=get_value(data_0), + ) + .sum + ) def tan( @@ -15195,14 +15829,18 @@ def tan( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Tan( - _Tan.Attributes(), - _Tan.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Tan( + _Tan.Attributes(), + _Tan.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def tanh( @@ -15231,14 +15869,18 @@ def tanh( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Tanh( - _Tanh.Attributes(), - _Tanh.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Tanh( + _Tanh.Attributes(), + _Tanh.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def tf_idf_vectorizer( @@ -15370,24 +16012,28 @@ def tf_idf_vectorizer( - T: `tensor(int32)`, `tensor(int64)`, `tensor(string)` - T1: `tensor(float)` """ - return _TfIdfVectorizer( - _TfIdfVectorizer.Attributes( - max_gram_length=AttrInt64(max_gram_length, name="max_gram_length"), - max_skip_count=AttrInt64(max_skip_count, name="max_skip_count"), - min_gram_length=AttrInt64(min_gram_length, name="min_gram_length"), - mode=AttrString(mode, name="mode"), - ngram_counts=AttrInt64s(ngram_counts, name="ngram_counts"), - ngram_indexes=AttrInt64s(ngram_indexes, name="ngram_indexes"), - pool_int64s=AttrInt64s.maybe(pool_int64s, name="pool_int64s"), - pool_strings=AttrStrings.maybe(pool_strings, name="pool_strings"), - weights=AttrFloat32s.maybe(weights, name="weights"), - ), - _TfIdfVectorizer.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _TfIdfVectorizer( + _TfIdfVectorizer.Attributes( + max_gram_length=AttrInt64(max_gram_length, name="max_gram_length"), + max_skip_count=AttrInt64(max_skip_count, name="max_skip_count"), + min_gram_length=AttrInt64(min_gram_length, name="min_gram_length"), + mode=AttrString(mode, name="mode"), + ngram_counts=AttrInt64s(ngram_counts, name="ngram_counts"), + ngram_indexes=AttrInt64s(ngram_indexes, name="ngram_indexes"), + pool_int64s=AttrInt64s.maybe(pool_int64s, name="pool_int64s"), + pool_strings=AttrStrings.maybe(pool_strings, name="pool_strings"), + weights=AttrFloat32s.maybe(weights, name="weights"), + ), + _TfIdfVectorizer.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def thresholded_relu( @@ -15422,16 +16068,20 @@ def thresholded_relu( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _ThresholdedRelu( - _ThresholdedRelu.Attributes( - alpha=AttrFloat32(alpha, name="alpha"), - ), - _ThresholdedRelu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _ThresholdedRelu( + _ThresholdedRelu.Attributes( + alpha=AttrFloat32(alpha, name="alpha"), + ), + _ThresholdedRelu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def tile( @@ -15468,16 +16118,20 @@ def tile( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Tile( - _Tile.Attributes(), - _Tile.Inputs( - input=unwrap_vars(input), - repeats=unwrap_vars(repeats), - ), - ).get_output_vars( - input=get_value(input), - repeats=get_value(repeats), - )["output"] + return ( + _Tile( + _Tile.Attributes(), + _Tile.Inputs( + input=unwrap_vars(input), + repeats=unwrap_vars(repeats), + ), + ) + .get_output_vars( + input=get_value(input), + repeats=get_value(repeats), + ) + .output + ) def top_k( @@ -15571,7 +16225,7 @@ def top_k( X=get_value(X), K=get_value(K), ) - .values() + ._unpack_to_any() ) @@ -15608,16 +16262,20 @@ def transpose( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Transpose( - _Transpose.Attributes( - perm=AttrInt64s.maybe(perm, name="perm"), - ), - _Transpose.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["transposed"] + return ( + _Transpose( + _Transpose.Attributes( + perm=AttrInt64s.maybe(perm, name="perm"), + ), + _Transpose.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .transposed + ) def trilu( @@ -15673,18 +16331,22 @@ def trilu( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Trilu( - _Trilu.Attributes( - upper=AttrInt64(upper, name="upper"), - ), - _Trilu.Inputs( - input=unwrap_vars(input), - k=unwrap_vars(k), - ), - ).get_output_vars( - input=get_value(input), - k=get_value(k), - )["output"] + return ( + _Trilu( + _Trilu.Attributes( + upper=AttrInt64(upper, name="upper"), + ), + _Trilu.Inputs( + input=unwrap_vars(input), + k=unwrap_vars(k), + ), + ) + .get_output_vars( + input=get_value(input), + k=get_value(k), + ) + .output + ) def unique( @@ -15869,7 +16531,7 @@ def unique( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) @@ -15918,16 +16580,20 @@ def unsqueeze( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Unsqueeze( - _Unsqueeze.Attributes(), - _Unsqueeze.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["expanded"] + return ( + _Unsqueeze( + _Unsqueeze.Attributes(), + _Unsqueeze.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .expanded + ) def where( @@ -15971,18 +16637,22 @@ def where( - B: `tensor(bool)` - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Where( - _Where.Attributes(), - _Where.Inputs( - condition=unwrap_vars(condition), - X=unwrap_vars(X), - Y=unwrap_vars(Y), - ), - ).get_output_vars( - condition=get_value(condition), - X=get_value(X), - Y=get_value(Y), - )["output"] + return ( + _Where( + _Where.Attributes(), + _Where.Inputs( + condition=unwrap_vars(condition), + X=unwrap_vars(X), + Y=unwrap_vars(Y), + ), + ) + .get_output_vars( + condition=get_value(condition), + X=get_value(X), + Y=get_value(Y), + ) + .output + ) def xor( @@ -16021,16 +16691,20 @@ def xor( - T: `tensor(bool)` - T1: `tensor(bool)` """ - return _Xor( - _Xor.Attributes(), - _Xor.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Xor( + _Xor.Attributes(), + _Xor.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def const(value: npt.ArrayLike, dtype: npt.DTypeLike = None) -> Var: diff --git a/src/spox/opset/ai/onnx/v18.py b/src/spox/opset/ai/onnx/v18.py index 1f191da..f8de6f3 100644 --- a/src/spox/opset/ai/onnx/v18.py +++ b/src/spox/opset/ai/onnx/v18.py @@ -934,16 +934,20 @@ def bitwise_and( Type constraints: - T: `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BitwiseAnd( - _BitwiseAnd.Attributes(), - _BitwiseAnd.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _BitwiseAnd( + _BitwiseAnd.Attributes(), + _BitwiseAnd.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def bitwise_not( @@ -971,14 +975,18 @@ def bitwise_not( Type constraints: - T: `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BitwiseNot( - _BitwiseNot.Attributes(), - _BitwiseNot.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _BitwiseNot( + _BitwiseNot.Attributes(), + _BitwiseNot.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def bitwise_or( @@ -1016,16 +1024,20 @@ def bitwise_or( Type constraints: - T: `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BitwiseOr( - _BitwiseOr.Attributes(), - _BitwiseOr.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _BitwiseOr( + _BitwiseOr.Attributes(), + _BitwiseOr.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def bitwise_xor( @@ -1063,16 +1075,20 @@ def bitwise_xor( Type constraints: - T: `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _BitwiseXor( - _BitwiseXor.Attributes(), - _BitwiseXor.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _BitwiseXor( + _BitwiseXor.Attributes(), + _BitwiseXor.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def center_crop_pad( @@ -1122,18 +1138,22 @@ def center_crop_pad( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _CenterCropPad( - _CenterCropPad.Attributes( - axes=AttrInt64s.maybe(axes, name="axes"), - ), - _CenterCropPad.Inputs( - input_data=unwrap_vars(input_data), - shape=unwrap_vars(shape), - ), - ).get_output_vars( - input_data=get_value(input_data), - shape=get_value(shape), - )["output_data"] + return ( + _CenterCropPad( + _CenterCropPad.Attributes( + axes=AttrInt64s.maybe(axes, name="axes"), + ), + _CenterCropPad.Inputs( + input_data=unwrap_vars(input_data), + shape=unwrap_vars(shape), + ), + ) + .get_output_vars( + input_data=get_value(input_data), + shape=get_value(shape), + ) + .output_data + ) def col2_im( @@ -1216,22 +1236,26 @@ def col2_im( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Col2Im( - _Col2Im.Attributes( - dilations=AttrInt64s.maybe(dilations, name="dilations"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _Col2Im.Inputs( - input=unwrap_vars(input), - image_shape=unwrap_vars(image_shape), - block_shape=unwrap_vars(block_shape), - ), - ).get_output_vars( - input=get_value(input), - image_shape=get_value(image_shape), - block_shape=get_value(block_shape), - )["output"] + return ( + _Col2Im( + _Col2Im.Attributes( + dilations=AttrInt64s.maybe(dilations, name="dilations"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _Col2Im.Inputs( + input=unwrap_vars(input), + image_shape=unwrap_vars(image_shape), + block_shape=unwrap_vars(block_shape), + ), + ) + .get_output_vars( + input=get_value(input), + image_shape=get_value(image_shape), + block_shape=get_value(block_shape), + ) + .output + ) def group_normalization( @@ -1299,21 +1323,25 @@ def group_normalization( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GroupNormalization( - _GroupNormalization.Attributes( - epsilon=AttrFloat32(epsilon, name="epsilon"), - num_groups=AttrInt64(num_groups, name="num_groups"), - ), - _GroupNormalization.Inputs( - X=unwrap_vars(X), - scale=unwrap_vars(scale), - bias=unwrap_vars(bias), - ), - ).get_output_vars( - X=get_value(X), - scale=get_value(scale), - bias=get_value(bias), - )["Y"] + return ( + _GroupNormalization( + _GroupNormalization.Attributes( + epsilon=AttrFloat32(epsilon, name="epsilon"), + num_groups=AttrInt64(num_groups, name="num_groups"), + ), + _GroupNormalization.Inputs( + X=unwrap_vars(X), + scale=unwrap_vars(scale), + bias=unwrap_vars(bias), + ), + ) + .get_output_vars( + X=get_value(X), + scale=get_value(scale), + bias=get_value(bias), + ) + .Y + ) def lp_pool( @@ -1424,22 +1452,26 @@ def lp_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _LpPool( - _LpPool.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), - p=AttrInt64(p, name="p"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _LpPool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _LpPool( + _LpPool.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), + p=AttrInt64(p, name="p"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _LpPool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def mish( @@ -1474,14 +1506,18 @@ def mish( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Mish( - _Mish.Attributes(), - _Mish.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Mish( + _Mish.Attributes(), + _Mish.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def optional_get_element( @@ -1513,14 +1549,18 @@ def optional_get_element( - O: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))`, `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - V: `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _OptionalGetElement( - _OptionalGetElement.Attributes(), - _OptionalGetElement.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _OptionalGetElement( + _OptionalGetElement.Attributes(), + _OptionalGetElement.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def optional_has_element( @@ -1552,14 +1592,18 @@ def optional_has_element( - O: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))`, `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - B: `tensor(bool)` """ - return _OptionalHasElement( - _OptionalHasElement.Attributes(), - _OptionalHasElement.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _OptionalHasElement( + _OptionalHasElement.Attributes(), + _OptionalHasElement.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def pad( @@ -1696,22 +1740,26 @@ def pad( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _Pad( - _Pad.Attributes( - mode=AttrString(mode, name="mode"), - ), - _Pad.Inputs( - data=unwrap_vars(data), - pads=unwrap_vars(pads), - constant_value=unwrap_vars(constant_value), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - pads=get_value(pads), - constant_value=get_value(constant_value), - axes=get_value(axes), - )["output"] + return ( + _Pad( + _Pad.Attributes( + mode=AttrString(mode, name="mode"), + ), + _Pad.Inputs( + data=unwrap_vars(data), + pads=unwrap_vars(pads), + constant_value=unwrap_vars(constant_value), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + pads=get_value(pads), + constant_value=get_value(constant_value), + axes=get_value(axes), + ) + .output + ) def reduce_l1( @@ -1767,21 +1815,25 @@ def reduce_l1( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceL1( - _ReduceL1.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceL1( + _ReduceL1.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceL1.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceL1.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_l2( @@ -1837,21 +1889,25 @@ def reduce_l2( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceL2( - _ReduceL2.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceL2( + _ReduceL2.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceL2.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), ), - ), - _ReduceL2.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_log_sum( @@ -1908,21 +1964,25 @@ def reduce_log_sum( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceLogSum( - _ReduceLogSum.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceLogSum( + _ReduceLogSum.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceLogSum.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceLogSum.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_log_sum_exp( @@ -1979,21 +2039,25 @@ def reduce_log_sum_exp( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceLogSumExp( - _ReduceLogSumExp.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceLogSumExp( + _ReduceLogSumExp.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceLogSumExp.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), ), - ), - _ReduceLogSumExp.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_max( @@ -2051,21 +2115,25 @@ def reduce_max( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMax( - _ReduceMax.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceMax( + _ReduceMax.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceMax.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceMax.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_mean( @@ -2121,21 +2189,25 @@ def reduce_mean( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceMean( - _ReduceMean.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceMean( + _ReduceMean.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceMean.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), ), - ), - _ReduceMean.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_min( @@ -2192,21 +2264,25 @@ def reduce_min( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMin( - _ReduceMin.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceMin( + _ReduceMin.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceMin.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceMin.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_prod( @@ -2262,21 +2338,25 @@ def reduce_prod( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceProd( - _ReduceProd.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceProd( + _ReduceProd.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceProd.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), ), - ), - _ReduceProd.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_sum_square( @@ -2332,21 +2412,25 @@ def reduce_sum_square( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(uint32)`, `tensor(uint64)` """ - return _ReduceSumSquare( - _ReduceSumSquare.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceSumSquare( + _ReduceSumSquare.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceSumSquare.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceSumSquare.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def resize( @@ -2519,36 +2603,41 @@ def resize( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Resize( - _Resize.Attributes( - antialias=AttrInt64(antialias, name="antialias"), - axes=AttrInt64s.maybe(axes, name="axes"), - coordinate_transformation_mode=AttrString( - coordinate_transformation_mode, name="coordinate_transformation_mode" - ), - cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), - exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), - extrapolation_value=AttrFloat32( - extrapolation_value, name="extrapolation_value" + return ( + _Resize( + _Resize.Attributes( + antialias=AttrInt64(antialias, name="antialias"), + axes=AttrInt64s.maybe(axes, name="axes"), + coordinate_transformation_mode=AttrString( + coordinate_transformation_mode, + name="coordinate_transformation_mode", + ), + cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), + exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), + extrapolation_value=AttrFloat32( + extrapolation_value, name="extrapolation_value" + ), + keep_aspect_ratio_policy=AttrString( + keep_aspect_ratio_policy, name="keep_aspect_ratio_policy" + ), + mode=AttrString(mode, name="mode"), + nearest_mode=AttrString(nearest_mode, name="nearest_mode"), ), - keep_aspect_ratio_policy=AttrString( - keep_aspect_ratio_policy, name="keep_aspect_ratio_policy" + _Resize.Inputs( + X=unwrap_vars(X), + roi=unwrap_vars(roi), + scales=unwrap_vars(scales), + sizes=unwrap_vars(sizes), ), - mode=AttrString(mode, name="mode"), - nearest_mode=AttrString(nearest_mode, name="nearest_mode"), - ), - _Resize.Inputs( - X=unwrap_vars(X), - roi=unwrap_vars(roi), - scales=unwrap_vars(scales), - sizes=unwrap_vars(sizes), - ), - ).get_output_vars( - X=get_value(X), - roi=get_value(roi), - scales=get_value(scales), - sizes=get_value(sizes), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + roi=get_value(roi), + scales=get_value(scales), + sizes=get_value(sizes), + ) + .Y + ) def scatter_elements( @@ -2674,21 +2763,25 @@ def scatter_elements( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _ScatterElements( - _ScatterElements.Attributes( - axis=AttrInt64(axis, name="axis"), - reduction=AttrString(reduction, name="reduction"), - ), - _ScatterElements.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - updates=unwrap_vars(updates), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - updates=get_value(updates), - )["output"] + return ( + _ScatterElements( + _ScatterElements.Attributes( + axis=AttrInt64(axis, name="axis"), + reduction=AttrString(reduction, name="reduction"), + ), + _ScatterElements.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + updates=unwrap_vars(updates), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + updates=get_value(updates), + ) + .output + ) def scatter_nd( @@ -2816,20 +2909,24 @@ def scatter_nd( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ScatterND( - _ScatterND.Attributes( - reduction=AttrString(reduction, name="reduction"), - ), - _ScatterND.Inputs( - data=unwrap_vars(data), - indices=unwrap_vars(indices), - updates=unwrap_vars(updates), - ), - ).get_output_vars( - data=get_value(data), - indices=get_value(indices), - updates=get_value(updates), - )["output"] + return ( + _ScatterND( + _ScatterND.Attributes( + reduction=AttrString(reduction, name="reduction"), + ), + _ScatterND.Inputs( + data=unwrap_vars(data), + indices=unwrap_vars(indices), + updates=unwrap_vars(updates), + ), + ) + .get_output_vars( + data=get_value(data), + indices=get_value(indices), + updates=get_value(updates), + ) + .output + ) def split( @@ -2879,20 +2976,24 @@ def split( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Split( - _Split.Attributes( - axis=AttrInt64(axis, name="axis"), - num_outputs=AttrInt64.maybe(num_outputs, name="num_outputs"), - ), - _Split.Inputs( - input=unwrap_vars(input), - split=unwrap_vars(split), - ), - out_variadic=num_outputs, - ).get_output_vars( - input=get_value(input), - split=get_value(split), - )["outputs"] + return ( + _Split( + _Split.Attributes( + axis=AttrInt64(axis, name="axis"), + num_outputs=AttrInt64.maybe(num_outputs, name="num_outputs"), + ), + _Split.Inputs( + input=unwrap_vars(input), + split=unwrap_vars(split), + ), + out_variadic=num_outputs, + ) + .get_output_vars( + input=get_value(input), + split=get_value(split), + ) + .outputs + ) def const(value: npt.ArrayLike, dtype: npt.DTypeLike = None) -> Var: diff --git a/src/spox/opset/ai/onnx/v19.py b/src/spox/opset/ai/onnx/v19.py index 8cf8cce..8fc23f6 100644 --- a/src/spox/opset/ai/onnx/v19.py +++ b/src/spox/opset/ai/onnx/v19.py @@ -916,22 +916,28 @@ def average_pool( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _AveragePool( - _AveragePool.Attributes( - auto_pad=AttrString(auto_pad, name="auto_pad"), - ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), - count_include_pad=AttrInt64(count_include_pad, name="count_include_pad"), - dilations=AttrInt64s.maybe(dilations, name="dilations"), - kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _AveragePool.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _AveragePool( + _AveragePool.Attributes( + auto_pad=AttrString(auto_pad, name="auto_pad"), + ceil_mode=AttrInt64(ceil_mode, name="ceil_mode"), + count_include_pad=AttrInt64( + count_include_pad, name="count_include_pad" + ), + dilations=AttrInt64s.maybe(dilations, name="dilations"), + kernel_shape=AttrInt64s(kernel_shape, name="kernel_shape"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _AveragePool.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def cast( @@ -1055,17 +1061,21 @@ def cast( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Cast( - _Cast.Attributes( - saturate=AttrInt64(saturate, name="saturate"), - to=AttrDtype(to, name="to"), - ), - _Cast.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Cast( + _Cast.Attributes( + saturate=AttrInt64(saturate, name="saturate"), + to=AttrDtype(to, name="to"), + ), + _Cast.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def cast_like( @@ -1111,18 +1121,22 @@ def cast_like( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _CastLike( - _CastLike.Attributes( - saturate=AttrInt64(saturate, name="saturate"), - ), - _CastLike.Inputs( - input=unwrap_vars(input), - target_type=unwrap_vars(target_type), - ), - ).get_output_vars( - input=get_value(input), - target_type=get_value(target_type), - )["output"] + return ( + _CastLike( + _CastLike.Attributes( + saturate=AttrInt64(saturate, name="saturate"), + ), + _CastLike.Inputs( + input=unwrap_vars(input), + target_type=unwrap_vars(target_type), + ), + ) + .get_output_vars( + input=get_value(input), + target_type=get_value(target_type), + ) + .output + ) def constant( @@ -1180,18 +1194,22 @@ def constant( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Constant( - _Constant.Attributes( - value=AttrTensor.maybe(value, name="value"), - value_float=AttrFloat32.maybe(value_float, name="value_float"), - value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), - value_int=AttrInt64.maybe(value_int, name="value_int"), - value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), - value_string=AttrString.maybe(value_string, name="value_string"), - value_strings=AttrStrings.maybe(value_strings, name="value_strings"), - ), - _Constant.Inputs(), - ).get_output_vars()["output"] + return ( + _Constant( + _Constant.Attributes( + value=AttrTensor.maybe(value, name="value"), + value_float=AttrFloat32.maybe(value_float, name="value_float"), + value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), + value_int=AttrInt64.maybe(value_int, name="value_int"), + value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), + value_string=AttrString.maybe(value_string, name="value_string"), + value_strings=AttrStrings.maybe(value_strings, name="value_strings"), + ), + _Constant.Inputs(), + ) + .get_output_vars() + .output + ) def deform_conv( @@ -1290,29 +1308,33 @@ def deform_conv( Type constraints: - T: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _DeformConv( - _DeformConv.Attributes( - dilations=AttrInt64s.maybe(dilations, name="dilations"), - group=AttrInt64(group, name="group"), - kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), - offset_group=AttrInt64(offset_group, name="offset_group"), - pads=AttrInt64s.maybe(pads, name="pads"), - strides=AttrInt64s.maybe(strides, name="strides"), - ), - _DeformConv.Inputs( - X=unwrap_vars(X), - W=unwrap_vars(W), - offset=unwrap_vars(offset), - B=unwrap_vars(B), - mask=unwrap_vars(mask), - ), - ).get_output_vars( - X=get_value(X), - W=get_value(W), - offset=get_value(offset), - B=get_value(B), - mask=get_value(mask), - )["Y"] + return ( + _DeformConv( + _DeformConv.Attributes( + dilations=AttrInt64s.maybe(dilations, name="dilations"), + group=AttrInt64(group, name="group"), + kernel_shape=AttrInt64s.maybe(kernel_shape, name="kernel_shape"), + offset_group=AttrInt64(offset_group, name="offset_group"), + pads=AttrInt64s.maybe(pads, name="pads"), + strides=AttrInt64s.maybe(strides, name="strides"), + ), + _DeformConv.Inputs( + X=unwrap_vars(X), + W=unwrap_vars(W), + offset=unwrap_vars(offset), + B=unwrap_vars(B), + mask=unwrap_vars(mask), + ), + ) + .get_output_vars( + X=get_value(X), + W=get_value(W), + offset=get_value(offset), + B=get_value(B), + mask=get_value(mask), + ) + .Y + ) def dequantize_linear( @@ -1370,20 +1392,24 @@ def dequantize_linear( - T1: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int32)`, `tensor(int8)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(float)`, `tensor(float16)` """ - return _DequantizeLinear( - _DequantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _DequantizeLinear.Inputs( - x=unwrap_vars(x), - x_scale=unwrap_vars(x_scale), - x_zero_point=unwrap_vars(x_zero_point), - ), - ).get_output_vars( - x=get_value(x), - x_scale=get_value(x_scale), - x_zero_point=get_value(x_zero_point), - )["y"] + return ( + _DequantizeLinear( + _DequantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _DequantizeLinear.Inputs( + x=unwrap_vars(x), + x_scale=unwrap_vars(x_scale), + x_zero_point=unwrap_vars(x_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + x_scale=get_value(x_scale), + x_zero_point=get_value(x_zero_point), + ) + .y + ) def equal( @@ -1422,16 +1448,20 @@ def equal( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(bool)` """ - return _Equal( - _Equal.Attributes(), - _Equal.Inputs( - A=unwrap_vars(A), - B=unwrap_vars(B), - ), - ).get_output_vars( - A=get_value(A), - B=get_value(B), - )["C"] + return ( + _Equal( + _Equal.Attributes(), + _Equal.Inputs( + A=unwrap_vars(A), + B=unwrap_vars(B), + ), + ) + .get_output_vars( + A=get_value(A), + B=get_value(B), + ) + .C + ) def identity( @@ -1459,14 +1489,18 @@ def identity( Type constraints: - V: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))`, `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Identity( - _Identity.Attributes(), - _Identity.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Identity( + _Identity.Attributes(), + _Identity.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def if_( @@ -1523,18 +1557,22 @@ def if_( """ _else_branch_subgraph: Graph = subgraph((), else_branch) _then_branch_subgraph: Graph = subgraph((), then_branch) - return _If( - _If.Attributes( - else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), - then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), - ), - _If.Inputs( - cond=unwrap_vars(cond), - ), - out_variadic=len(_else_branch_subgraph.requested_results), - ).get_output_vars( - cond=get_value(cond), - )["outputs"] + return ( + _If( + _If.Attributes( + else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), + then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), + ), + _If.Inputs( + cond=unwrap_vars(cond), + ), + out_variadic=len(_else_branch_subgraph.requested_results), + ) + .get_output_vars( + cond=get_value(cond), + ) + .outputs + ) def loop( @@ -1718,21 +1756,25 @@ def loop( + [var.unwrap_type() for var in v_initial], body, ) - return _Loop( - _Loop.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - ), - _Loop.Inputs( - M=unwrap_vars(M), - cond=unwrap_vars(cond), - v_initial=unwrap_vars(v_initial), - ), - out_variadic=len(_body_subgraph.requested_results) - 1, - ).get_output_vars( - M=get_value(M), - cond=get_value(cond), - v_initial=get_value(v_initial), - )["v_final_and_scan_outputs"] + return ( + _Loop( + _Loop.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + ), + _Loop.Inputs( + M=unwrap_vars(M), + cond=unwrap_vars(cond), + v_initial=unwrap_vars(v_initial), + ), + out_variadic=len(_body_subgraph.requested_results) - 1, + ) + .get_output_vars( + M=get_value(M), + cond=get_value(cond), + v_initial=get_value(v_initial), + ) + .v_final_and_scan_outputs + ) def pad( @@ -1895,22 +1937,26 @@ def pad( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _Pad( - _Pad.Attributes( - mode=AttrString(mode, name="mode"), - ), - _Pad.Inputs( - data=unwrap_vars(data), - pads=unwrap_vars(pads), - constant_value=unwrap_vars(constant_value), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - pads=get_value(pads), - constant_value=get_value(constant_value), - axes=get_value(axes), - )["output"] + return ( + _Pad( + _Pad.Attributes( + mode=AttrString(mode, name="mode"), + ), + _Pad.Inputs( + data=unwrap_vars(data), + pads=unwrap_vars(pads), + constant_value=unwrap_vars(constant_value), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + pads=get_value(pads), + constant_value=get_value(constant_value), + axes=get_value(axes), + ) + .output + ) def quantize_linear( @@ -1979,21 +2025,25 @@ def quantize_linear( - T1: `tensor(bfloat16)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)` - T2: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int8)`, `tensor(uint8)` """ - return _QuantizeLinear( - _QuantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - saturate=AttrInt64(saturate, name="saturate"), - ), - _QuantizeLinear.Inputs( - x=unwrap_vars(x), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - ), - ).get_output_vars( - x=get_value(x), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - )["y"] + return ( + _QuantizeLinear( + _QuantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + saturate=AttrInt64(saturate, name="saturate"), + ), + _QuantizeLinear.Inputs( + x=unwrap_vars(x), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + ) + .y + ) def reshape( @@ -2047,18 +2097,22 @@ def reshape( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Reshape( - _Reshape.Attributes( - allowzero=AttrInt64(allowzero, name="allowzero"), - ), - _Reshape.Inputs( - data=unwrap_vars(data), - shape=unwrap_vars(shape), - ), - ).get_output_vars( - data=get_value(data), - shape=get_value(shape), - )["reshaped"] + return ( + _Reshape( + _Reshape.Attributes( + allowzero=AttrInt64(allowzero, name="allowzero"), + ), + _Reshape.Inputs( + data=unwrap_vars(data), + shape=unwrap_vars(shape), + ), + ) + .get_output_vars( + data=get_value(data), + shape=get_value(shape), + ) + .reshaped + ) def resize( @@ -2269,36 +2323,41 @@ def resize( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Resize( - _Resize.Attributes( - antialias=AttrInt64(antialias, name="antialias"), - axes=AttrInt64s.maybe(axes, name="axes"), - coordinate_transformation_mode=AttrString( - coordinate_transformation_mode, name="coordinate_transformation_mode" - ), - cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), - exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), - extrapolation_value=AttrFloat32( - extrapolation_value, name="extrapolation_value" + return ( + _Resize( + _Resize.Attributes( + antialias=AttrInt64(antialias, name="antialias"), + axes=AttrInt64s.maybe(axes, name="axes"), + coordinate_transformation_mode=AttrString( + coordinate_transformation_mode, + name="coordinate_transformation_mode", + ), + cubic_coeff_a=AttrFloat32(cubic_coeff_a, name="cubic_coeff_a"), + exclude_outside=AttrInt64(exclude_outside, name="exclude_outside"), + extrapolation_value=AttrFloat32( + extrapolation_value, name="extrapolation_value" + ), + keep_aspect_ratio_policy=AttrString( + keep_aspect_ratio_policy, name="keep_aspect_ratio_policy" + ), + mode=AttrString(mode, name="mode"), + nearest_mode=AttrString(nearest_mode, name="nearest_mode"), ), - keep_aspect_ratio_policy=AttrString( - keep_aspect_ratio_policy, name="keep_aspect_ratio_policy" + _Resize.Inputs( + X=unwrap_vars(X), + roi=unwrap_vars(roi), + scales=unwrap_vars(scales), + sizes=unwrap_vars(sizes), ), - mode=AttrString(mode, name="mode"), - nearest_mode=AttrString(nearest_mode, name="nearest_mode"), - ), - _Resize.Inputs( - X=unwrap_vars(X), - roi=unwrap_vars(roi), - scales=unwrap_vars(scales), - sizes=unwrap_vars(sizes), - ), - ).get_output_vars( - X=get_value(X), - roi=get_value(roi), - scales=get_value(scales), - sizes=get_value(sizes), - )["Y"] + ) + .get_output_vars( + X=get_value(X), + roi=get_value(roi), + scales=get_value(scales), + sizes=get_value(sizes), + ) + .Y + ) def scan( @@ -2522,28 +2581,36 @@ def scan( ], body, ) - return _Scan( - _Scan.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), - scan_input_axes=AttrInt64s.maybe(scan_input_axes, name="scan_input_axes"), - scan_input_directions=AttrInt64s.maybe( - scan_input_directions, name="scan_input_directions" - ), - scan_output_axes=AttrInt64s.maybe( - scan_output_axes, name="scan_output_axes" + return ( + _Scan( + _Scan.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), + scan_input_axes=AttrInt64s.maybe( + scan_input_axes, name="scan_input_axes" + ), + scan_input_directions=AttrInt64s.maybe( + scan_input_directions, name="scan_input_directions" + ), + scan_output_axes=AttrInt64s.maybe( + scan_output_axes, name="scan_output_axes" + ), + scan_output_directions=AttrInt64s.maybe( + scan_output_directions, name="scan_output_directions" + ), ), - scan_output_directions=AttrInt64s.maybe( - scan_output_directions, name="scan_output_directions" + _Scan.Inputs( + initial_state_and_scan_inputs=unwrap_vars( + initial_state_and_scan_inputs + ), ), - ), - _Scan.Inputs( - initial_state_and_scan_inputs=unwrap_vars(initial_state_and_scan_inputs), - ), - out_variadic=len(_body_subgraph.requested_results), - ).get_output_vars( - initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), - )["final_state_and_scan_outputs"] + out_variadic=len(_body_subgraph.requested_results), + ) + .get_output_vars( + initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), + ) + .final_state_and_scan_outputs + ) def shape( @@ -2622,17 +2689,21 @@ def shape( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Shape( - _Shape.Attributes( - end=AttrInt64.maybe(end, name="end"), - start=AttrInt64(start, name="start"), - ), - _Shape.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["shape"] + return ( + _Shape( + _Shape.Attributes( + end=AttrInt64.maybe(end, name="end"), + start=AttrInt64(start, name="start"), + ), + _Shape.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .shape + ) def size( @@ -2662,14 +2733,18 @@ def size( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Size( - _Size.Attributes(), - _Size.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["size"] + return ( + _Size( + _Size.Attributes(), + _Size.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .size + ) def const(value: npt.ArrayLike, dtype: npt.DTypeLike = None) -> Var: diff --git a/src/spox/opset/ai/onnx/v20.py b/src/spox/opset/ai/onnx/v20.py index e9bdebf..0e1d406 100644 --- a/src/spox/opset/ai/onnx/v20.py +++ b/src/spox/opset/ai/onnx/v20.py @@ -733,18 +733,22 @@ def affine_grid( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int64)` """ - return _AffineGrid( - _AffineGrid.Attributes( - align_corners=AttrInt64(align_corners, name="align_corners"), - ), - _AffineGrid.Inputs( - theta=unwrap_vars(theta), - size=unwrap_vars(size), - ), - ).get_output_vars( - theta=get_value(theta), - size=get_value(size), - )["grid"] + return ( + _AffineGrid( + _AffineGrid.Attributes( + align_corners=AttrInt64(align_corners, name="align_corners"), + ), + _AffineGrid.Inputs( + theta=unwrap_vars(theta), + size=unwrap_vars(size), + ), + ) + .get_output_vars( + theta=get_value(theta), + size=get_value(size), + ) + .grid + ) def constant_of_shape( @@ -784,16 +788,20 @@ def constant_of_shape( - T1: `tensor(int64)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ConstantOfShape( - _ConstantOfShape.Attributes( - value=AttrTensor.maybe(value, name="value"), - ), - _ConstantOfShape.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _ConstantOfShape( + _ConstantOfShape.Attributes( + value=AttrTensor.maybe(value, name="value"), + ), + _ConstantOfShape.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def dft( @@ -886,21 +894,25 @@ def dft( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` - T2: `tensor(int32)`, `tensor(int64)` """ - return _DFT( - _DFT.Attributes( - inverse=AttrInt64(inverse, name="inverse"), - onesided=AttrInt64(onesided, name="onesided"), - ), - _DFT.Inputs( - input=unwrap_vars(input), - dft_length=unwrap_vars(dft_length), - axis=unwrap_vars(axis), - ), - ).get_output_vars( - input=get_value(input), - dft_length=get_value(dft_length), - axis=get_value(axis), - )["output"] + return ( + _DFT( + _DFT.Attributes( + inverse=AttrInt64(inverse, name="inverse"), + onesided=AttrInt64(onesided, name="onesided"), + ), + _DFT.Inputs( + input=unwrap_vars(input), + dft_length=unwrap_vars(dft_length), + axis=unwrap_vars(axis), + ), + ) + .get_output_vars( + input=get_value(input), + dft_length=get_value(dft_length), + axis=get_value(axis), + ) + .output + ) def gelu( @@ -941,16 +953,20 @@ def gelu( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _Gelu( - _Gelu.Attributes( - approximate=AttrString(approximate, name="approximate"), - ), - _Gelu.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _Gelu( + _Gelu.Attributes( + approximate=AttrString(approximate, name="approximate"), + ), + _Gelu.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def grid_sample( @@ -1055,20 +1071,24 @@ def grid_sample( - T1: `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GridSample( - _GridSample.Attributes( - align_corners=AttrInt64(align_corners, name="align_corners"), - mode=AttrString(mode, name="mode"), - padding_mode=AttrString(padding_mode, name="padding_mode"), - ), - _GridSample.Inputs( - X=unwrap_vars(X), - grid=unwrap_vars(grid), - ), - ).get_output_vars( - X=get_value(X), - grid=get_value(grid), - )["Y"] + return ( + _GridSample( + _GridSample.Attributes( + align_corners=AttrInt64(align_corners, name="align_corners"), + mode=AttrString(mode, name="mode"), + padding_mode=AttrString(padding_mode, name="padding_mode"), + ), + _GridSample.Inputs( + X=unwrap_vars(X), + grid=unwrap_vars(grid), + ), + ) + .get_output_vars( + X=get_value(X), + grid=get_value(grid), + ) + .Y + ) def image_decoder( @@ -1129,16 +1149,20 @@ def image_decoder( - T1: `tensor(uint8)` - T2: `tensor(uint8)` """ - return _ImageDecoder( - _ImageDecoder.Attributes( - pixel_format=AttrString(pixel_format, name="pixel_format"), - ), - _ImageDecoder.Inputs( - encoded_stream=unwrap_vars(encoded_stream), - ), - ).get_output_vars( - encoded_stream=get_value(encoded_stream), - )["image"] + return ( + _ImageDecoder( + _ImageDecoder.Attributes( + pixel_format=AttrString(pixel_format, name="pixel_format"), + ), + _ImageDecoder.Inputs( + encoded_stream=unwrap_vars(encoded_stream), + ), + ) + .get_output_vars( + encoded_stream=get_value(encoded_stream), + ) + .image + ) def isinf( @@ -1180,17 +1204,21 @@ def isinf( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)` - T2: `tensor(bool)` """ - return _IsInf( - _IsInf.Attributes( - detect_negative=AttrInt64(detect_negative, name="detect_negative"), - detect_positive=AttrInt64(detect_positive, name="detect_positive"), - ), - _IsInf.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _IsInf( + _IsInf.Attributes( + detect_negative=AttrInt64(detect_negative, name="detect_negative"), + detect_positive=AttrInt64(detect_positive, name="detect_positive"), + ), + _IsInf.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def isnan( @@ -1219,14 +1247,18 @@ def isnan( - T1: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)` - T2: `tensor(bool)` """ - return _IsNaN( - _IsNaN.Attributes(), - _IsNaN.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _IsNaN( + _IsNaN.Attributes(), + _IsNaN.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def reduce_max( @@ -1287,21 +1319,25 @@ def reduce_max( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMax( - _ReduceMax.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceMax( + _ReduceMax.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), ), - ), - _ReduceMax.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + _ReduceMax.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def reduce_min( @@ -1361,21 +1397,25 @@ def reduce_min( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint32)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ReduceMin( - _ReduceMin.Attributes( - keepdims=AttrInt64(keepdims, name="keepdims"), - noop_with_empty_axes=AttrInt64( - noop_with_empty_axes, name="noop_with_empty_axes" + return ( + _ReduceMin( + _ReduceMin.Attributes( + keepdims=AttrInt64(keepdims, name="keepdims"), + noop_with_empty_axes=AttrInt64( + noop_with_empty_axes, name="noop_with_empty_axes" + ), + ), + _ReduceMin.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), ), - ), - _ReduceMin.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["reduced"] + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .reduced + ) def regex_full_match( @@ -1414,16 +1454,20 @@ def regex_full_match( - T1: `tensor(string)` - T2: `tensor(bool)` """ - return _RegexFullMatch( - _RegexFullMatch.Attributes( - pattern=AttrString.maybe(pattern, name="pattern"), - ), - _RegexFullMatch.Inputs( - X=unwrap_vars(X), - ), - ).get_output_vars( - X=get_value(X), - )["Y"] + return ( + _RegexFullMatch( + _RegexFullMatch.Attributes( + pattern=AttrString.maybe(pattern, name="pattern"), + ), + _RegexFullMatch.Inputs( + X=unwrap_vars(X), + ), + ) + .get_output_vars( + X=get_value(X), + ) + .Y + ) def string_concat( @@ -1456,16 +1500,20 @@ def string_concat( Type constraints: - T: `tensor(string)` """ - return _StringConcat( - _StringConcat.Attributes(), - _StringConcat.Inputs( - X=unwrap_vars(X), - Y=unwrap_vars(Y), - ), - ).get_output_vars( - X=get_value(X), - Y=get_value(Y), - )["Z"] + return ( + _StringConcat( + _StringConcat.Attributes(), + _StringConcat.Inputs( + X=unwrap_vars(X), + Y=unwrap_vars(Y), + ), + ) + .get_output_vars( + X=get_value(X), + Y=get_value(Y), + ) + .Z + ) def string_split( @@ -1550,7 +1598,7 @@ def string_split( .get_output_vars( X=get_value(X), ) - .values() + ._unpack_to_any() ) diff --git a/src/spox/opset/ai/onnx/v21.py b/src/spox/opset/ai/onnx/v21.py index 1f7110a..52e3027 100644 --- a/src/spox/opset/ai/onnx/v21.py +++ b/src/spox/opset/ai/onnx/v21.py @@ -964,17 +964,21 @@ def cast( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Cast( - _Cast.Attributes( - saturate=AttrInt64(saturate, name="saturate"), - to=AttrDtype(to, name="to"), - ), - _Cast.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Cast( + _Cast.Attributes( + saturate=AttrInt64(saturate, name="saturate"), + to=AttrDtype(to, name="to"), + ), + _Cast.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def cast_like( @@ -1020,18 +1024,22 @@ def cast_like( - T1: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _CastLike( - _CastLike.Attributes( - saturate=AttrInt64(saturate, name="saturate"), - ), - _CastLike.Inputs( - input=unwrap_vars(input), - target_type=unwrap_vars(target_type), - ), - ).get_output_vars( - input=get_value(input), - target_type=get_value(target_type), - )["output"] + return ( + _CastLike( + _CastLike.Attributes( + saturate=AttrInt64(saturate, name="saturate"), + ), + _CastLike.Inputs( + input=unwrap_vars(input), + target_type=unwrap_vars(target_type), + ), + ) + .get_output_vars( + input=get_value(input), + target_type=get_value(target_type), + ) + .output + ) def constant( @@ -1089,18 +1097,22 @@ def constant( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Constant( - _Constant.Attributes( - value=AttrTensor.maybe(value, name="value"), - value_float=AttrFloat32.maybe(value_float, name="value_float"), - value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), - value_int=AttrInt64.maybe(value_int, name="value_int"), - value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), - value_string=AttrString.maybe(value_string, name="value_string"), - value_strings=AttrStrings.maybe(value_strings, name="value_strings"), - ), - _Constant.Inputs(), - ).get_output_vars()["output"] + return ( + _Constant( + _Constant.Attributes( + value=AttrTensor.maybe(value, name="value"), + value_float=AttrFloat32.maybe(value_float, name="value_float"), + value_floats=AttrFloat32s.maybe(value_floats, name="value_floats"), + value_int=AttrInt64.maybe(value_int, name="value_int"), + value_ints=AttrInt64s.maybe(value_ints, name="value_ints"), + value_string=AttrString.maybe(value_string, name="value_string"), + value_strings=AttrStrings.maybe(value_strings, name="value_strings"), + ), + _Constant.Inputs(), + ) + .get_output_vars() + .output + ) def constant_of_shape( @@ -1140,16 +1152,20 @@ def constant_of_shape( - T1: `tensor(int64)` - T2: `tensor(bfloat16)`, `tensor(bool)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _ConstantOfShape( - _ConstantOfShape.Attributes( - value=AttrTensor.maybe(value, name="value"), - ), - _ConstantOfShape.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _ConstantOfShape( + _ConstantOfShape.Attributes( + value=AttrTensor.maybe(value, name="value"), + ), + _ConstantOfShape.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def dequantize_linear( @@ -1220,21 +1236,25 @@ def dequantize_linear( - T1: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint4)`, `tensor(uint8)` - T2: `tensor(bfloat16)`, `tensor(float)`, `tensor(float16)` """ - return _DequantizeLinear( - _DequantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - block_size=AttrInt64(block_size, name="block_size"), - ), - _DequantizeLinear.Inputs( - x=unwrap_vars(x), - x_scale=unwrap_vars(x_scale), - x_zero_point=unwrap_vars(x_zero_point), - ), - ).get_output_vars( - x=get_value(x), - x_scale=get_value(x_scale), - x_zero_point=get_value(x_zero_point), - )["y"] + return ( + _DequantizeLinear( + _DequantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + block_size=AttrInt64(block_size, name="block_size"), + ), + _DequantizeLinear.Inputs( + x=unwrap_vars(x), + x_scale=unwrap_vars(x_scale), + x_zero_point=unwrap_vars(x_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + x_scale=get_value(x_scale), + x_zero_point=get_value(x_zero_point), + ) + .y + ) def flatten( @@ -1276,16 +1296,20 @@ def flatten( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Flatten( - _Flatten.Attributes( - axis=AttrInt64(axis, name="axis"), - ), - _Flatten.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Flatten( + _Flatten.Attributes( + axis=AttrInt64(axis, name="axis"), + ), + _Flatten.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def group_normalization( @@ -1367,22 +1391,26 @@ def group_normalization( Type constraints: - T: `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` """ - return _GroupNormalization( - _GroupNormalization.Attributes( - epsilon=AttrFloat32(epsilon, name="epsilon"), - num_groups=AttrInt64(num_groups, name="num_groups"), - stash_type=AttrInt64(stash_type, name="stash_type"), - ), - _GroupNormalization.Inputs( - X=unwrap_vars(X), - scale=unwrap_vars(scale), - bias=unwrap_vars(bias), - ), - ).get_output_vars( - X=get_value(X), - scale=get_value(scale), - bias=get_value(bias), - )["Y"] + return ( + _GroupNormalization( + _GroupNormalization.Attributes( + epsilon=AttrFloat32(epsilon, name="epsilon"), + num_groups=AttrInt64(num_groups, name="num_groups"), + stash_type=AttrInt64(stash_type, name="stash_type"), + ), + _GroupNormalization.Inputs( + X=unwrap_vars(X), + scale=unwrap_vars(scale), + bias=unwrap_vars(bias), + ), + ) + .get_output_vars( + X=get_value(X), + scale=get_value(scale), + bias=get_value(bias), + ) + .Y + ) def identity( @@ -1410,14 +1438,18 @@ def identity( Type constraints: - V: `optional(seq(tensor(bool)))`, `optional(seq(tensor(complex128)))`, `optional(seq(tensor(complex64)))`, `optional(seq(tensor(double)))`, `optional(seq(tensor(float)))`, `optional(seq(tensor(float16)))`, `optional(seq(tensor(int16)))`, `optional(seq(tensor(int32)))`, `optional(seq(tensor(int64)))`, `optional(seq(tensor(int8)))`, `optional(seq(tensor(string)))`, `optional(seq(tensor(uint16)))`, `optional(seq(tensor(uint32)))`, `optional(seq(tensor(uint64)))`, `optional(seq(tensor(uint8)))`, `optional(tensor(bool))`, `optional(tensor(complex128))`, `optional(tensor(complex64))`, `optional(tensor(double))`, `optional(tensor(float))`, `optional(tensor(float16))`, `optional(tensor(int16))`, `optional(tensor(int32))`, `optional(tensor(int64))`, `optional(tensor(int8))`, `optional(tensor(string))`, `optional(tensor(uint16))`, `optional(tensor(uint32))`, `optional(tensor(uint64))`, `optional(tensor(uint8))`, `seq(tensor(bool))`, `seq(tensor(complex128))`, `seq(tensor(complex64))`, `seq(tensor(double))`, `seq(tensor(float))`, `seq(tensor(float16))`, `seq(tensor(int16))`, `seq(tensor(int32))`, `seq(tensor(int64))`, `seq(tensor(int8))`, `seq(tensor(string))`, `seq(tensor(uint16))`, `seq(tensor(uint32))`, `seq(tensor(uint64))`, `seq(tensor(uint8))`, `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Identity( - _Identity.Attributes(), - _Identity.Inputs( - input=unwrap_vars(input), - ), - ).get_output_vars( - input=get_value(input), - )["output"] + return ( + _Identity( + _Identity.Attributes(), + _Identity.Inputs( + input=unwrap_vars(input), + ), + ) + .get_output_vars( + input=get_value(input), + ) + .output + ) def if_( @@ -1474,18 +1506,22 @@ def if_( """ _else_branch_subgraph: Graph = subgraph((), else_branch) _then_branch_subgraph: Graph = subgraph((), then_branch) - return _If( - _If.Attributes( - else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), - then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), - ), - _If.Inputs( - cond=unwrap_vars(cond), - ), - out_variadic=len(_else_branch_subgraph.requested_results), - ).get_output_vars( - cond=get_value(cond), - )["outputs"] + return ( + _If( + _If.Attributes( + else_branch=AttrGraph(_else_branch_subgraph, name="else_branch"), + then_branch=AttrGraph(_then_branch_subgraph, name="then_branch"), + ), + _If.Inputs( + cond=unwrap_vars(cond), + ), + out_variadic=len(_else_branch_subgraph.requested_results), + ) + .get_output_vars( + cond=get_value(cond), + ) + .outputs + ) def loop( @@ -1669,21 +1705,25 @@ def loop( + [var.unwrap_type() for var in v_initial], body, ) - return _Loop( - _Loop.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - ), - _Loop.Inputs( - M=unwrap_vars(M), - cond=unwrap_vars(cond), - v_initial=unwrap_vars(v_initial), - ), - out_variadic=len(_body_subgraph.requested_results) - 1, - ).get_output_vars( - M=get_value(M), - cond=get_value(cond), - v_initial=get_value(v_initial), - )["v_final_and_scan_outputs"] + return ( + _Loop( + _Loop.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + ), + _Loop.Inputs( + M=unwrap_vars(M), + cond=unwrap_vars(cond), + v_initial=unwrap_vars(v_initial), + ), + out_variadic=len(_body_subgraph.requested_results) - 1, + ) + .get_output_vars( + M=get_value(M), + cond=get_value(cond), + v_initial=get_value(v_initial), + ) + .v_final_and_scan_outputs + ) def pad( @@ -1846,22 +1886,26 @@ def pad( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` - Tind: `tensor(int32)`, `tensor(int64)` """ - return _Pad( - _Pad.Attributes( - mode=AttrString(mode, name="mode"), - ), - _Pad.Inputs( - data=unwrap_vars(data), - pads=unwrap_vars(pads), - constant_value=unwrap_vars(constant_value), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - pads=get_value(pads), - constant_value=get_value(constant_value), - axes=get_value(axes), - )["output"] + return ( + _Pad( + _Pad.Attributes( + mode=AttrString(mode, name="mode"), + ), + _Pad.Inputs( + data=unwrap_vars(data), + pads=unwrap_vars(pads), + constant_value=unwrap_vars(constant_value), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + pads=get_value(pads), + constant_value=get_value(constant_value), + axes=get_value(axes), + ) + .output + ) def qlinear_matmul( @@ -1937,28 +1981,32 @@ def qlinear_matmul( - T2: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int8)`, `tensor(uint8)` - T3: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int8)`, `tensor(uint8)` """ - return _QLinearMatMul( - _QLinearMatMul.Attributes(), - _QLinearMatMul.Inputs( - a=unwrap_vars(a), - a_scale=unwrap_vars(a_scale), - a_zero_point=unwrap_vars(a_zero_point), - b=unwrap_vars(b), - b_scale=unwrap_vars(b_scale), - b_zero_point=unwrap_vars(b_zero_point), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - ), - ).get_output_vars( - a=get_value(a), - a_scale=get_value(a_scale), - a_zero_point=get_value(a_zero_point), - b=get_value(b), - b_scale=get_value(b_scale), - b_zero_point=get_value(b_zero_point), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - )["y"] + return ( + _QLinearMatMul( + _QLinearMatMul.Attributes(), + _QLinearMatMul.Inputs( + a=unwrap_vars(a), + a_scale=unwrap_vars(a_scale), + a_zero_point=unwrap_vars(a_zero_point), + b=unwrap_vars(b), + b_scale=unwrap_vars(b_scale), + b_zero_point=unwrap_vars(b_zero_point), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + ), + ) + .get_output_vars( + a=get_value(a), + a_scale=get_value(a_scale), + a_zero_point=get_value(a_zero_point), + b=get_value(b), + b_scale=get_value(b_scale), + b_zero_point=get_value(b_zero_point), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + ) + .y + ) def quantize_linear( @@ -2066,23 +2114,27 @@ def quantize_linear( - T1: `tensor(bfloat16)`, `tensor(float)`, `tensor(float16)`, `tensor(int32)` - T2: `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int4)`, `tensor(int8)`, `tensor(uint16)`, `tensor(uint4)`, `tensor(uint8)` """ - return _QuantizeLinear( - _QuantizeLinear.Attributes( - axis=AttrInt64(axis, name="axis"), - block_size=AttrInt64(block_size, name="block_size"), - output_dtype=AttrInt64(output_dtype, name="output_dtype"), - saturate=AttrInt64(saturate, name="saturate"), - ), - _QuantizeLinear.Inputs( - x=unwrap_vars(x), - y_scale=unwrap_vars(y_scale), - y_zero_point=unwrap_vars(y_zero_point), - ), - ).get_output_vars( - x=get_value(x), - y_scale=get_value(y_scale), - y_zero_point=get_value(y_zero_point), - )["y"] + return ( + _QuantizeLinear( + _QuantizeLinear.Attributes( + axis=AttrInt64(axis, name="axis"), + block_size=AttrInt64(block_size, name="block_size"), + output_dtype=AttrInt64(output_dtype, name="output_dtype"), + saturate=AttrInt64(saturate, name="saturate"), + ), + _QuantizeLinear.Inputs( + x=unwrap_vars(x), + y_scale=unwrap_vars(y_scale), + y_zero_point=unwrap_vars(y_zero_point), + ), + ) + .get_output_vars( + x=get_value(x), + y_scale=get_value(y_scale), + y_zero_point=get_value(y_zero_point), + ) + .y + ) def reshape( @@ -2136,18 +2188,22 @@ def reshape( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Reshape( - _Reshape.Attributes( - allowzero=AttrInt64(allowzero, name="allowzero"), - ), - _Reshape.Inputs( - data=unwrap_vars(data), - shape=unwrap_vars(shape), - ), - ).get_output_vars( - data=get_value(data), - shape=get_value(shape), - )["reshaped"] + return ( + _Reshape( + _Reshape.Attributes( + allowzero=AttrInt64(allowzero, name="allowzero"), + ), + _Reshape.Inputs( + data=unwrap_vars(data), + shape=unwrap_vars(shape), + ), + ) + .get_output_vars( + data=get_value(data), + shape=get_value(shape), + ) + .reshaped + ) def scan( @@ -2371,28 +2427,36 @@ def scan( ], body, ) - return _Scan( - _Scan.Attributes( - body=AttrGraph(_body_subgraph, name="body"), - num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), - scan_input_axes=AttrInt64s.maybe(scan_input_axes, name="scan_input_axes"), - scan_input_directions=AttrInt64s.maybe( - scan_input_directions, name="scan_input_directions" - ), - scan_output_axes=AttrInt64s.maybe( - scan_output_axes, name="scan_output_axes" + return ( + _Scan( + _Scan.Attributes( + body=AttrGraph(_body_subgraph, name="body"), + num_scan_inputs=AttrInt64(num_scan_inputs, name="num_scan_inputs"), + scan_input_axes=AttrInt64s.maybe( + scan_input_axes, name="scan_input_axes" + ), + scan_input_directions=AttrInt64s.maybe( + scan_input_directions, name="scan_input_directions" + ), + scan_output_axes=AttrInt64s.maybe( + scan_output_axes, name="scan_output_axes" + ), + scan_output_directions=AttrInt64s.maybe( + scan_output_directions, name="scan_output_directions" + ), ), - scan_output_directions=AttrInt64s.maybe( - scan_output_directions, name="scan_output_directions" + _Scan.Inputs( + initial_state_and_scan_inputs=unwrap_vars( + initial_state_and_scan_inputs + ), ), - ), - _Scan.Inputs( - initial_state_and_scan_inputs=unwrap_vars(initial_state_and_scan_inputs), - ), - out_variadic=len(_body_subgraph.requested_results), - ).get_output_vars( - initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), - )["final_state_and_scan_outputs"] + out_variadic=len(_body_subgraph.requested_results), + ) + .get_output_vars( + initial_state_and_scan_inputs=get_value(initial_state_and_scan_inputs), + ) + .final_state_and_scan_outputs + ) def shape( @@ -2471,17 +2535,21 @@ def shape( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Shape( - _Shape.Attributes( - end=AttrInt64.maybe(end, name="end"), - start=AttrInt64(start, name="start"), - ), - _Shape.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["shape"] + return ( + _Shape( + _Shape.Attributes( + end=AttrInt64.maybe(end, name="end"), + start=AttrInt64(start, name="start"), + ), + _Shape.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .shape + ) def size( @@ -2511,14 +2579,18 @@ def size( - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` - T1: `tensor(int64)` """ - return _Size( - _Size.Attributes(), - _Size.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["size"] + return ( + _Size( + _Size.Attributes(), + _Size.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .size + ) def squeeze( @@ -2556,16 +2628,20 @@ def squeeze( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Squeeze( - _Squeeze.Attributes(), - _Squeeze.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["squeezed"] + return ( + _Squeeze( + _Squeeze.Attributes(), + _Squeeze.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .squeezed + ) def transpose( @@ -2602,16 +2678,20 @@ def transpose( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Transpose( - _Transpose.Attributes( - perm=AttrInt64s.maybe(perm, name="perm"), - ), - _Transpose.Inputs( - data=unwrap_vars(data), - ), - ).get_output_vars( - data=get_value(data), - )["transposed"] + return ( + _Transpose( + _Transpose.Attributes( + perm=AttrInt64s.maybe(perm, name="perm"), + ), + _Transpose.Inputs( + data=unwrap_vars(data), + ), + ) + .get_output_vars( + data=get_value(data), + ) + .transposed + ) def unsqueeze( @@ -2659,16 +2739,20 @@ def unsqueeze( Type constraints: - T: `tensor(bfloat16)`, `tensor(bool)`, `tensor(complex128)`, `tensor(complex64)`, `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float8e4m3fn)`, `tensor(float8e4m3fnuz)`, `tensor(float8e5m2)`, `tensor(float8e5m2fnuz)`, `tensor(int16)`, `tensor(int32)`, `tensor(int4)`, `tensor(int64)`, `tensor(int8)`, `tensor(string)`, `tensor(uint16)`, `tensor(uint32)`, `tensor(uint4)`, `tensor(uint64)`, `tensor(uint8)` """ - return _Unsqueeze( - _Unsqueeze.Attributes(), - _Unsqueeze.Inputs( - data=unwrap_vars(data), - axes=unwrap_vars(axes), - ), - ).get_output_vars( - data=get_value(data), - axes=get_value(axes), - )["expanded"] + return ( + _Unsqueeze( + _Unsqueeze.Attributes(), + _Unsqueeze.Inputs( + data=unwrap_vars(data), + axes=unwrap_vars(axes), + ), + ) + .get_output_vars( + data=get_value(data), + axes=get_value(axes), + ) + .expanded + ) def const(value: npt.ArrayLike, dtype: npt.DTypeLike = None) -> Var: diff --git a/tests/test_adapt.py b/tests/test_adapt.py index d3b01a0..25c4764 100644 --- a/tests/test_adapt.py +++ b/tests/test_adapt.py @@ -97,10 +97,14 @@ class Outputs(BaseOutputs): def squeeze11(_data: Var, _axes: Iterable[int]): - return Squeeze11( - Squeeze11.Attributes(AttrInt64s(_axes, "axes")), - Squeeze11.Inputs(_data._var_info), - ).get_output_vars()["squeezed"] + return ( + Squeeze11( + Squeeze11.Attributes(AttrInt64s(_axes, "axes")), + Squeeze11.Inputs(_data._var_info), + ) + .get_output_vars() + .squeezed + ) @pytest.fixture diff --git a/tests/test_custom_operator.py b/tests/test_custom_operator.py index 752a17f..fc102a8 100644 --- a/tests/test_custom_operator.py +++ b/tests/test_custom_operator.py @@ -67,9 +67,11 @@ def propagate_values(self, initializers) -> dict[str, np.ndarray]: # Define the operator constructor which is actually used def inverse(matrix: Var) -> Var: - return Inverse( - Inverse.Attributes(), Inverse.Inputs(matrix._var_info) - ).get_output_vars(X=matrix._value)["Y"] + return ( + Inverse(Inverse.Attributes(), Inverse.Inputs(matrix._var_info)) + .get_output_vars(X=matrix._value) + .Y + ) # Test the correct runtime behaviour with ORT diff --git a/tests/test_function.py b/tests/test_function.py index 7e78ef2..ce6ec4c 100644 --- a/tests/test_function.py +++ b/tests/test_function.py @@ -62,13 +62,17 @@ def constructor(self, attrs: dict[str, Attr], inputs: Inputs) -> Outputs: def linear_inner( x: Var, a: Union[float, _Ref[float]], b: Union[float, _Ref[float]] ) -> Var: - return LinearFunction( - LinearFunction.Attributes( - slope_outer=AttrFloat32(a, "slope_outer"), - shift_outer=AttrFloat32(b, "shift_outer"), - ), - LinearFunction.Inputs(x._var_info), - ).get_output_vars(X=x._value)["Y"] + return ( + LinearFunction( + LinearFunction.Attributes( + slope_outer=AttrFloat32(a, "slope_outer"), + shift_outer=AttrFloat32(b, "shift_outer"), + ), + LinearFunction.Inputs(x._var_info), + ) + .get_output_vars(X=x._value) + .Y + ) return linear_inner @@ -107,12 +111,17 @@ def constructor(self, attrs: dict[str, Attr], inputs: Inputs) -> Outputs: def linear_inner( x: Var, a: Union[float, _Ref[float]], b: Union[float, _Ref[float]] ) -> Var: - return LinearFunction2( - LinearFunction2.Attributes( - slope1=AttrFloat32(a, name="slope1"), shift1=AttrFloat32(b, "shift1") - ), - LinearFunction2.Inputs(x._var_info), - ).get_output_vars(X=x._value)["Y"] + return ( + LinearFunction2( + LinearFunction2.Attributes( + slope1=AttrFloat32(a, name="slope1"), + shift1=AttrFloat32(b, "shift1"), + ), + LinearFunction2.Inputs(x._var_info), + ) + .get_output_vars(X=x._value) + .Y + ) return linear_inner @@ -168,15 +177,19 @@ def constructor(self, attrs: dict[str, Attr], inputs: Inputs) -> Outputs: return self.Outputs(y._var_info) def cubic_inner(x: Var, a3: float, a2: float, a1: float, a0: float) -> Var: - return CubicFunction( - CubicFunction.Attributes( - a3=AttrFloat32(a3, name="a3"), - a2=AttrFloat32(a2, name="a2"), - a1=AttrFloat32(a1, name="a1"), - a0=AttrFloat32(a0, name="a0"), - ), - CubicFunction.Inputs(X=x._var_info), - ).get_output_vars()["Y"] + return ( + CubicFunction( + CubicFunction.Attributes( + a3=AttrFloat32(a3, name="a3"), + a2=AttrFloat32(a2, name="a2"), + a1=AttrFloat32(a1, name="a1"), + a0=AttrFloat32(a0, name="a0"), + ), + CubicFunction.Inputs(X=x._var_info), + ) + .get_output_vars() + .Y + ) return cubic_inner diff --git a/tests/test_value_propagation.py b/tests/test_value_propagation.py index 30cc678..06a1955 100644 --- a/tests/test_value_propagation.py +++ b/tests/test_value_propagation.py @@ -12,8 +12,8 @@ from spox import Var, _type_system from spox._graph import arguments, results from spox._shape import Shape -from spox._var import VarInfo from spox._value_prop import ORTValue, PropValue +from spox._var import VarInfo @pytest.fixture( diff --git a/tools/templates/construct.jinja2 b/tools/templates/construct.jinja2 index f0225a5..e57f6c5 100644 --- a/tools/templates/construct.jinja2 +++ b/tools/templates/construct.jinja2 @@ -42,6 +42,6 @@ endif %}).get_output_vars( endfor %} ){% if schema.outputs | length <= 1 - %}["{{ schema.outputs[0].name }}"]{% -else %}.values(){% + %}.{{ schema.outputs[0].name }}{% +else %}._unpack_to_any(){% endif %}