repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
onnx | onnx/reference/ops/op_reduce_log_sum_exp.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
def compute_log_sum_exp(data, axes, keepdims):
data_max = data.copy()
ind = np.isinf(data_max)
data_max[ind] = -np.in... | 44 | 1,283 |
onnx | onnx/reference/ops/op_range.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
from onnx import TensorProto
from onnx.reference.op_run import OpRun
_STASH_TYPE_TO_DTYPE: dict[int, np.dtype] = {
int(TensorProto.FLOAT): np.dtype(np.float32),
... | 40 | 1,410 |
onnx | onnx/reference/ops/op_non_zero.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class NonZero(OpRun):
def _run(self, x):
if x.ndim == 0:
return (np.empty((0, np.count_nonzero(x)), dtype=np.int64),)... | 18 | 451 |
onnx | onnx/reference/ops/op_sequence_at.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.op_run import OpRun
class SequenceAt(OpRun):
def _run(self, seq, index):
return (seq[index],)
| 12 | 245 |
onnx | onnx/reference/ops/op_clip.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class Clip_6(OpRun):
def _run(self, data, min=None, max=None): # type: ignore[override] # noqa: A002
amin = min
amax = ... | 26 | 806 |
onnx | onnx/reference/ops/op_deform_conv.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops import op_grid_sample
def _deform_conv_implementation(
X, W, offset, B, mask, dilations, group, kernel_shape, of... | 182 | 6,291 |
onnx | onnx/reference/ops/op_abs.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Abs(OpRunUnaryNum):
def _run(self, x):
return (np.absolute(x),)
| 14 | 270 |
onnx | onnx/reference/ops/op_slice.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRun
def _slice(
data: np.ndarray,
starts: np.ndarray,
ends: np.ndarray,
axes: np.ndarray | None = None,
steps: np.ndarray | ... | 76 | 2,399 |
onnx | onnx/reference/ops/op_bitcast.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.reference.op_run import OpRun
class BitCast(OpRun):
def _run(self, x, to: int): # type: ignore[override]
if to == onnx.TensorProto.STRING:
... | 30 | 957 |
onnx | onnx/reference/ops/op_dynamic_quantize_linear.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class DynamicQuantizeLinear(OpRun):
def _run(self, x):
# args: x, y_scale, zero_point
dtype, qmin, qmax = np.uint8, 0, 25... | 33 | 965 |
onnx | onnx/reference/ops/op_resize.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
from typing import TYPE_CHECKING, Any
import numpy as np
import onnx
from onnx.reference.op_run import OpRun
if TYPE_CHECKING:
from collections.abc import Callable
def _cartesian(arr... | 666 | 23,331 |
onnx | onnx/reference/ops/op_rms_normalization.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def _rms_normalization(
X: np.ndarray,
W: np.ndarray,
axis: int = -1,
epsilon: float = 1e-5,
) -> np.ndarray:
shape = X.s... | 50 | 1,334 |
onnx | onnx/reference/ops/op_regex_full_match.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import re
import numpy as np
from onnx.reference.op_run import OpRun
_acceptable_str_dtypes = ("U", "O")
class RegexFullMatch(OpRun):
def _run(self, x, pattern=None):
# Note: The ONNX sp... | 37 | 1,292 |
onnx | onnx/reference/ops/aionnx_preview_training/op_adagrad.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_adagrad(r, t, x, g, h, norm_coefficient, epsilon, decay_factor):
# Compute adjus... | 65 | 1,917 |
onnx | onnx/reference/ops/aionnx_preview_training/op_adam.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_adam(
r, t, x, g, v, h, norm_coefficient, norm_coefficient_post, alpha, beta, ep... | 106 | 2,863 |
onnx | onnx/reference/ops/aionnx_preview_training/op_momentum.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_momentum(r, t, x, g, v, norm_coefficient, alpha, beta):
# Add gradient of regularization term.
g... | 83 | 2,467 |
onnx | onnx/reference/ops/aionnx_preview_training/_op_list.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
"load_op",
"Adagrad",
"Adam",
"Momentum",
]
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers impor... | 90 | 2,864 |
onnx | onnx/reference/ops/aionnx_preview_training/_op_run_training.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.op_run import OpRun
class OpRunTraining(OpRun):
op_domain = "ai.onnx.preview.training"
| 11 | 230 |
onnx | onnx/reference/ops/experimental/op_im2col.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.experimental._op_run_experimental import OpRunExperimental
from onnx.reference.ops_optimized.op_conv_optimized import im2col_fast
class Im2Col(OpRunExperimental):
def _run(... | 36 | 1,406 |
onnx | onnx/reference/ops/experimental/_op_list.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers import build_registered_operators_any_domain
from onnx.reference.ops.experimen... | 73 | 2,284 |
onnx | onnx/reference/ops/aionnx_preview/op_flex_attention.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import ml_dtypes
import numpy as np
from onnx import TensorProto
from onnx.reference.op_run import OpRun
if TYPE_CHECKING:
from collections.abc import Sequen... | 161 | 5,305 |
onnx | onnx/reference/ops/aionnx_preview/_op_list.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
"load_op",
"FlexAttention",
]
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers import build_registered_ope... | 86 | 2,708 |
onnx | onnx/reference/ops/aionnxml/_op_run_aionnxml.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.op_run import OpRun
class OpRunAiOnnxMl(OpRun):
op_domain = "ai.onnx.ml"
| 9 | 173 |
onnx | onnx/reference/ops/aionnxml/op_imputer.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Imputer(OpRunAiOnnxMl):
def _run(
self,
x,
imputed_value_floats=None,
... | 48 | 1,568 |
onnx | onnx/reference/ops/aionnxml/op_binarizer.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
def compute_binarizer(x, threshold=None):
return ((x > threshold).astype(x.dtype),)
class Binarizer(OpRunAiOnnxMl):
def ... | 16 | 398 |
onnx | onnx/reference/ops/aionnxml/op_scaler.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Scaler(OpRunAiOnnxMl):
def _run(self, x, offset=None, scale=None):
dx = x - offset
return ((dx * scale).... | 13 | 338 |
onnx | onnx/reference/ops/aionnxml/_common_classifier.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
def compute_logistic(val: float) -> float:
v = 1.0 / (1.0 + np.exp(-np.abs(val)))
return (1.0 - v) if val < 0 else v
logistic = np.vectorize(compute_logistic)
def compute_softmax_zero(values: np.ndarray) -> np.nda... | 80 | 1,928 |
onnx | onnx/reference/ops/aionnxml/op_tree_ensemble_regressor.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
from onnx.reference.ops.aionnxml.op_tree_ensemble_helper import TreeEnsemble
class TreeEnsembleRegressor(OpRun... | 110 | 4,104 |
onnx | onnx/reference/ops/aionnxml/op_linear_classifier.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
compute_probit,
compute_softmax_zero,
expit,
)
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunA... | 99 | 3,589 |
onnx | onnx/reference/ops/aionnxml/op_one_hot_encoder.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class OneHotEncoder(OpRunAiOnnxMl):
def _run(self, x, cats_int64s=None, cats_strings=None, zeros=None):
... | 54 | 1,913 |
onnx | onnx/reference/ops/aionnxml/op_normalizer.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Normalizer(OpRunAiOnnxMl):
@staticmethod
def norm_max(x):
"""Max normalization"""
... | 42 | 1,158 |
onnx | onnx/reference/ops/aionnxml/op_linear_regressor.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class LinearRegressor(OpRunAiOnnxMl):
def _run(
self, x, coefficients=None, intercepts=None, targe... | 27 | 863 |
onnx | onnx/reference/ops/aionnxml/op_array_feature_extractor.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
def _array_feature_extractor(data, indices):
"""Implementation of operator *ArrayFeatureExtractor*."""
if len(indices.shap... | 48 | 1,612 |
onnx | onnx/reference/ops/aionnxml/_op_list.py | .py | # SPDX-License-Identifier: Apache-2.0
# Operator ZipMap is not implemented. Its use should
# be discouraged. It is just a different way to output
# probabilities not consumed by any operator.
from __future__ import annotations
__all__ = [
"load_op",
"ArrayFeatureExtractor",
"Binarizer",
"DictVectorize... | 122 | 4,326 |
onnx | onnx/reference/ops/aionnxml/op_dict_vectorizer.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class DictVectorizer(OpRunAiOnnxMl):
def _run(self, x, int64_vocabulary=None, string_vocabulary=None):
... | 48 | 1,731 |
onnx | onnx/reference/ops/aionnxml/op_svm_classifier.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
compute_logistic,
compute_probit,
compute_softmax_zero,
logistic,
softmax,
softmax_zero,
)
from on... | 334 | 11,382 |
onnx | onnx/reference/ops/aionnxml/op_tree_ensemble_classifier.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
logistic,
probit,
softmax,
softmax_zero,
)
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunA... | 133 | 4,844 |
onnx | onnx/reference/ops/aionnxml/op_svm_regressor.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
from onnx.reference.ops.aionnxml.op_svm_helper import SVMCommon
class SVMRegressor(OpRunAiOnnxMl):
"""The class only implement... | 44 | 1,256 |
onnx | onnx/reference/ops/aionnxml/op_label_encoder.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class LabelEncoder(OpRunAiOnnxMl):
def _run(
self,
x,
default_float=None,
... | 51 | 1,558 |
onnx | onnx/reference/ops/aionnxml/op_tree_ensemble_helper.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
class TreeEnsembleAttributes:
def __init__(self):
self._names = []
def add(self, name, value):
if not name.endswith("_as_tensor"):
self._names.ap... | 104 | 3,591 |
onnx | onnx/reference/ops/aionnxml/op_svm_helper.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
class SVMAttributes:
def __init__(self):
self._names = []
def add(self, name: str, value: Any) -> None:
if isinstance(value, list) an... | 98 | 3,080 |
onnx | onnx/reference/ops/aionnxml/op_tree_ensemble.py | .py | from __future__ import annotations
from enum import IntEnum
from typing import TYPE_CHECKING
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
if TYPE_CHECKING:
from collections.abc import Callable
class AggregationFunction(IntEnum):
AVERAGE = 0
SUM = 1
MIN ... | 269 | 9,388 |
onnx | onnx/reference/ops/aionnxml/op_feature_vectorizer.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class FeatureVectorizer(OpRunAiOnnxMl):
def _preprocess(self, a, cut):
if len(a.shape) == 1:
... | 32 | 936 |
onnx | onnx/tools/update_model_dims.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import onnx.checker
from onnx import ModelProto, ValueInfoProto
def update_inputs_outputs_dims(
model: ModelProto,
input_dims: dict[str, list[Any]],
output_dims: dic... | 99 | 3,462 |
onnx | onnx/tools/replace_constants.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx import (
AttributeProto,
FunctionProto,
GraphProto,
ModelProto,
NodeProto,
SparseTensorProto,
TensorProto,
)
from onnx.helper import (
make_a... | 422 | 14,993 |
onnx | onnx/backend/base.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from collections import namedtuple
from typing import TYPE_CHECKING, Any, NewType
import onnx.checker
import onnx.onnx_cpp2py_export.checker as c_checker
from onnx import IR_VERSION, ModelProto, NodePr... | 149 | 4,862 |
onnx | onnx/backend/test/cmd_tools.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import argparse
import json
import os
import shutil
import onnx.backend.test.case.model as model_test
from onnx import TensorProto, numpy_helper
TOP_DIR = os.path.realpath(os.path.dirname(__file__))
D... | 141 | 5,686 |
onnx | onnx/backend/test/stat_coverage.py | .py | #!/usr/bin/env python
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
from typing import IO, TYPE_CHECKING, Any
from onnx import AttributeProto, defs, load
from onnx.backend.test.case import collect_snippets
from onnx.backend.test.loader ... | 300 | 11,812 |
onnx | onnx/backend/test/case/utils.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import importlib
import pkgutil
from typing import TYPE_CHECKING
import numpy as np
from onnx import ONNX_ML
if TYPE_CHECKING:
from types import ModuleType
all_numeric_dtypes = [
np.int8,
... | 46 | 1,040 |
onnx | onnx/backend/test/case/__init__.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import sys
from onnx.backend.test.case.base import Snippets
from onnx.backend.test.case.utils import import_recursive
def collect_snippets() -> dict[str, list[tuple[str, str]]]:
import_recursive(s... | 15 | 362 |
onnx | onnx/backend/test/case/test_case.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Sequence
import numpy as np
import onnx
@dataclass
class TestCase:
na... | 30 | 625 |
onnx | onnx/backend/test/case/base.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import inspect
from collections import defaultdict
from textwrap import dedent
from typing import Any, ClassVar
import numpy as np
def process_snippet(op_name: str, name: str, export: Any) -> tuple[st... | 48 | 1,504 |
onnx | onnx/backend/test/case/node/globalaveragepool.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class GlobalAveragePool(Base):
@staticmethod
def export() -> None:
... | 45 | 1,274 |
onnx | onnx/backend/test/case/node/asin.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Asin(Base):
@staticmethod
def export() -> None:
node =... | 29 | 726 |
onnx | onnx/backend/test/case/node/splittosequence.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class SplitToSequence(Base):
@staticmethod
def export_with_split_1()... | 81 | 2,129 |
onnx | onnx/backend/test/case/node/regex_full_match.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class RegexFullMatch(Base):
@staticmethod
def export_basic() -> None... | 69 | 1,914 |
onnx | onnx/backend/test/case/node/matmulinteger.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class MatMulInteger(Base):
@staticmethod
def export() -> None:
... | 61 | 1,331 |
onnx | onnx/backend/test/case/node/logsoftmax.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def logsoftmax(x: np.ndarray, axis: int = -1) -> np.ndarray:
x_max = np.... | 93 | 2,773 |
onnx | onnx/backend/test/case/node/bitwiseor.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.numpy_helper import create_random_int
class BitwiseOr(Base):
@... | 53 | 1,640 |
onnx | onnx/backend/test/case/node/less.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Less(Base):
@staticmethod
def export() -> None:
node =... | 69 | 2,386 |
onnx | onnx/backend/test/case/node/split.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Split(Base):
@staticmethod
def export_1d_opset13() -> None:
... | 379 | 11,845 |
onnx | onnx/backend/test/case/node/tfidfvectorizer.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx import NodeProto
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class TfIdfVectorizerHelp... | 265 | 8,868 |
onnx | onnx/backend/test/case/node/constantofshape.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ConstantOfShape(Base):
@staticmethod
def export_float_ones() -... | 65 | 1,872 |
onnx | onnx/backend/test/case/node/lppool.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.reference.ops.op_pool_common import (
get_output_shape_auto_pad,... | 299 | 9,007 |
onnx | onnx/backend/test/case/node/and_.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class And(Base):
@staticmethod
def export() -> None:
node = ... | 77 | 2,504 |
onnx | onnx/backend/test/case/node/selu.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Selu(Base):
@staticmethod
def export() -> None:
node =... | 50 | 1,536 |
onnx | onnx/backend/test/case/node/softplus.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Softplus(Base):
@staticmethod
def export() -> None:
no... | 31 | 835 |
onnx | onnx/backend/test/case/node/reshape.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def reshape_reference_implementation(
data: np.ndarray, shape: np.ndarra... | 83 | 2,889 |
onnx | onnx/backend/test/case/node/swish.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def swish(x: np.ndarray, alpha: float) -> np.ndarray:
return x * (1 / (1... | 37 | 851 |
onnx | onnx/backend/test/case/node/hannwindow.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class HannWindow(Base):
@staticmethod
def export() -> None:
... | 46 | 1,222 |
onnx | onnx/backend/test/case/node/momentum.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_momentum(r, ... | 163 | 5,293 |
onnx | onnx/backend/test/case/node/det.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Det(Base):
@staticmethod
def export_2d() -> None:
node... | 39 | 1,010 |
onnx | onnx/backend/test/case/node/resize.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.reference.ops.op_resize import _cubic_coeffs as cubic_coeffs
from on... | 1,715 | 51,672 |
onnx | onnx/backend/test/case/node/celu.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Celu(Base):
@staticmethod
def export() -> Non... | 98 | 2,943 |
onnx | onnx/backend/test/case/node/rmsnormalization.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.reference.ops.op_rms_normalization import _rms_normalization
def c... | 127 | 3,912 |
onnx | onnx/backend/test/case/node/depthtospace.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class DepthToSpace(Base):
@staticmethod
def export_default_mode_exam... | 99 | 3,570 |
onnx | onnx/backend/test/case/node/lrn.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class LRN(Base):
@staticmethod
def export() -> None:
... | 71 | 2,096 |
onnx | onnx/backend/test/case/node/gatherelements.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
# The below GatherElements' numpy implementation is from https://stackoverfl... | 93 | 2,669 |
onnx | onnx/backend/test/case/node/cosh.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Cosh(Base):
@staticmethod
def export() -> None:
node =... | 29 | 769 |
onnx | onnx/backend/test/case/node/transpose.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Transpose(Base):
@staticmethod
def export_de... | 48 | 1,391 |
onnx | onnx/backend/test/case/node/string_concat.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class StringConcat(Base):
@staticmethod
def export() -> None:
... | 70 | 1,980 |
onnx | onnx/backend/test/case/node/adam.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_adam(
r,... | 136 | 4,417 |
onnx | onnx/backend/test/case/node/dft.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class DFT(Base):
@staticmethod
def export_opset19() -> None:
... | 153 | 5,913 |
onnx | onnx/backend/test/case/node/round.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Round(Base):
@staticmethod
def export() -> None:
node ... | 63 | 1,322 |
onnx | onnx/backend/test/case/node/convtranspose.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ConvTranspose(Base):
@staticmethod
def export() -> None:
... | 533 | 21,372 |
onnx | onnx/backend/test/case/node/reducemin.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ReduceMin(Base):
@staticmethod
def export_do_not_keepdims() ->... | 235 | 6,763 |
onnx | onnx/backend/test/case/node/globalmaxpool.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class GlobalMaxPool(Base):
@staticmethod
def export() -> None:
... | 45 | 1,249 |
onnx | onnx/backend/test/case/node/nonzero.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class NonZero(Base):
@staticmethod
def export() -> None:
nod... | 27 | 723 |
onnx | onnx/backend/test/case/node/div.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Div(Base):
@staticmethod
def export() -> None:
node = ... | 79 | 2,847 |
onnx | onnx/backend/test/case/node/center_crop_pad.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class CenterCropPad(Base):
@staticmethod
def export_center_crop_pad_... | 131 | 3,939 |
onnx | onnx/backend/test/case/node/ceil.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Ceil(Base):
@staticmethod
def export() -> None:
node =... | 29 | 749 |
onnx | onnx/backend/test/case/node/isinf.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class IsInf(Base):
@staticmethod
def export_infinity() -> None:
... | 57 | 1,723 |
onnx | onnx/backend/test/case/node/elu.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Elu(Base):
@staticmethod
def export() -> None:
node = ... | 38 | 1,259 |
onnx | onnx/backend/test/case/node/reducemax.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ReduceMax(Base):
@staticmethod
def export_do_not_keepdims() ->... | 232 | 6,721 |
onnx | onnx/backend/test/case/node/abs.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Abs(Base):
@staticmethod
def export() -> None:
node = ... | 25 | 567 |
onnx | onnx/backend/test/case/node/shrink.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Shrink(Base):
@staticmethod
def export_hard_shrink() -> None:
... | 38 | 1,053 |
onnx | onnx/backend/test/case/node/clip.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Clip(Base):
@staticmethod
def export() -> None:
node =... | 145 | 4,582 |
onnx | onnx/backend/test/case/node/unique.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def specify_int64(indices, inverse_indices, counts):
return (
np... | 230 | 7,025 |
onnx | onnx/backend/test/case/node/sin.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Sin(Base):
@staticmethod
def export() -> None:
node = ... | 29 | 713 |
onnx | onnx/backend/test/case/node/upsample.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx import helper
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Upsample(Base):
@staticmethod
def expo... | 59 | 1,372 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.