text stringlengths 24 1.04M | metadata stringlengths 233 497 |
|---|---|
### File: onnx/reference/ops/aionnx_preview_training/op_adam.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_adam( # type: ignore
r, t, x, g, v, h, norm_coeff... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnx_preview_training/op_adam.py", "license": "apache-2.0", "size": 2928} |
### File: onnx/reference/ops/aionnx_preview_training/op_momentum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_momentum(r, t, x, g, v, norm_coefficient, alpha, beta): # type: ignore... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnx_preview_training/op_momentum.py", "license": "apache-2.0", "size": 2444} |
### File: onnx/reference/ops/aionnxml/__init__.py
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnxml._op_list import load_op
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/__init__.py", "license": "apache-2.0", "size": 96} |
### File: onnx/reference/ops/aionnxml/_common_classifier.py
# SPDX-License-Identifier: Apache-2.0
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 # type: ignore
logistic = np.vectorize(compute_logistic)
def compute_s... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/_common_classifier.py", "license": "apache-2.0", "size": 1973} |
### File: onnx/reference/ops/aionnxml/_op_list.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
# probabilites not consumed by any operator.
import textwrap
from typing import Any, Dict
from typing import Optional as T... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/_op_list.py", "license": "apache-2.0", "size": 4040} |
### File: onnx/reference/ops/aionnxml/_op_run_aionnxml.py
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class OpRunAiOnnxMl(OpRun):
op_domain = "ai.onnx.ml"
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/_op_run_aionnxml.py", "license": "apache-2.0", "size": 139} |
### File: onnx/reference/ops/aionnxml/op_array_feature_extractor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
def _array_feature_extrator(data, indices): # type: ignore
"""
Implementation of operat... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_array_feature_extractor.py", "license": "apache-2.0", "size": 1644} |
### File: onnx/reference/ops/aionnxml/op_binarizer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
def compute_binarizer(x, threshold=None):
return ((x > threshold).astype(x.dtype),)
class Binarizer(OpRu... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_binarizer.py", "license": "apache-2.0", "size": 380} |
### File: onnx/reference/ops/aionnxml/op_dict_vectorizer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class DictVectorizer(OpRunAiOnnxMl):
def _run(self, x, int64_vocabulary=None, st... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_dict_vectorizer.py", "license": "apache-2.0", "size": 1874} |
### File: onnx/reference/ops/aionnxml/op_feature_vectorizer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class FeatureVectorizer(OpRunAiOnnxMl):
def _preprocess(self, a, cut): # typ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_feature_vectorizer.py", "license": "apache-2.0", "size": 924} |
### File: onnx/reference/ops/aionnxml/op_imputer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Imputer(OpRunAiOnnxMl):
def _run( # type: ignore
self,
x,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_imputer.py", "license": "apache-2.0", "size": 1556} |
### File: onnx/reference/ops/aionnxml/op_label_encoder.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class LabelEncoder(OpRunAiOnnxMl):
def _run( # type: ignore
self,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_label_encoder.py", "license": "apache-2.0", "size": 1526} |
### File: onnx/reference/ops/aionnxml/op_linear_classifier.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
compute_probit,
compute_softmax_zero,
expit,
)
from onnx.reference.ops.aionnxml._o... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_linear_classifier.py", "license": "apache-2.0", "size": 3580} |
### File: onnx/reference/ops/aionnxml/op_linear_regressor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class LinearRegressor(OpRunAiOnnxMl):
def _run( # type: ignore
self, x... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_linear_regressor.py", "license": "apache-2.0", "size": 845} |
### File: onnx/reference/ops/aionnxml/op_normalizer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Normalizer(OpRunAiOnnxMl):
@staticmethod
def norm_max(x): # type: ignore
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_normalizer.py", "license": "apache-2.0", "size": 1176} |
### File: onnx/reference/ops/aionnxml/op_one_hot_encoder.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
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_str... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_one_hot_encoder.py", "license": "apache-2.0", "size": 1895} |
### File: onnx/reference/ops/aionnxml/op_scaler.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Scaler(OpRunAiOnnxMl):
def _run(self, x, offset=None, scale=None): # type: ignore
dx = x - off... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_scaler.py", "license": "apache-2.0", "size": 320} |
### File: onnx/reference/ops/aionnxml/op_svm_classifier.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
compute_logistic,
compute_probit,
compute_softmax_zero,
logistic,
softmax,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_svm_classifier.py", "license": "apache-2.0", "size": 11648} |
### File: onnx/reference/ops/aionnxml/op_svm_helper.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Any
import numpy as np
class SVMAttributes:
def __init__(self):
self._names = []
def add(self, name: str, value: Any) -> None:
if isins... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_svm_helper.py", "license": "apache-2.0", "size": 3351} |
### File: onnx/reference/ops/aionnxml/op_svm_regressor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
from onnx.reference.ops.aionnxml.op_svm_helper import SVMCommon
class SVMRegressor(OpRunAiOnnxMl):
"""... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_svm_regressor.py", "license": "apache-2.0", "size": 1248} |
### File: onnx/reference/ops/aionnxml/op_tree_ensemble_classifier.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
logistic,
probit,
softmax,
softmax_zero,
)
from onnx.reference.ops.aion... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_tree_ensemble_classifier.py", "license": "apache-2.0", "size": 4892} |
### File: onnx/reference/ops/aionnxml/op_tree_ensemble_helper.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
class TreeEnsembleAttributes:
def __init__(self):
self._names = []
def add(self, name, value):
if not name.endswith("_as_tenso... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_tree_ensemble_helper.py", "license": "apache-2.0", "size": 3761} |
### File: onnx/reference/ops/aionnxml/op_tree_ensemble_regressor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
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
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/aionnxml/op_tree_ensemble_regressor.py", "license": "apache-2.0", "size": 4012} |
### File: onnx/reference/ops/experimental/__init__.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.experimental._op_list import load_op
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/experimental/__init__.py", "license": "apache-2.0", "size": 144} |
### File: onnx/reference/ops/experimental/_op_list.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import textwrap
from typing import Any, Dict
from typing import Optional as TOptional
from typing import Union
from onnx.reference.op_run import OpFunction
from onnx.reference.ops._h... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/experimental/_op_list.py", "license": "apache-2.0", "size": 2920} |
### File: onnx/reference/ops/experimental/_op_run_experimental.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class OpRunExperimental(OpRun):
op_domain = "experimental"
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/experimental/_op_run_experimental.py", "license": "apache-2.0", "size": 189} |
### File: onnx/reference/ops/experimental/op_im2col.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.experimental._op_run_experimental import OpRunExperimental
from onnx.reference.ops_optimized.op_conv_optimized import im2col_fast
class Im2Col(OpRunExperim... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/experimental/op_im2col.py", "license": "apache-2.0", "size": 1420} |
### File: onnx/reference/ops/op_abs.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Abs(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.absolute(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_abs.py", "license": "apache-2.0", "size": 252} |
### File: onnx/reference/ops/op_acos.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Acos(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arccos(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_acos.py", "license": "apache-2.0", "size": 251} |
### File: onnx/reference/ops/op_acosh.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Acosh(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arccosh(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_acosh.py", "license": "apache-2.0", "size": 253} |
### File: onnx/reference/ops/op_add.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Add(OpRunBinaryNumpy):
def __init__(self, onnx_node, run_params): # type: ignore
OpRunBinaryNumpy.__init_... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_add.py", "license": "apache-2.0", "size": 320} |
### File: onnx/reference/ops/op_affine_grid.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def construct_original_grid(data_size, align_corners):
is_2d = len(data_size) == 2
size_zeros = np.zeros(dat... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_affine_grid.py", "license": "apache-2.0", "size": 3649} |
### File: onnx/reference/ops/op_and.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinary
class And(OpRunBinary):
def _run(self, x, y): # type: ignore
return (np.logical_and(x, y),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_and.py", "license": "apache-2.0", "size": 257} |
### File: onnx/reference/ops/op_argmax.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _argmax(data, axis=0, keepdims=True): # type: ignore
result = np.argmax(data, axis=axis)
if keepdims and len(result.shap... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_argmax.py", "license": "apache-2.0", "size": 1228} |
### File: onnx/reference/ops/op_argmin.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _argmin(data, axis=0, keepdims=True): # type: ignore
result = np.argmin(data, axis=axis)
if keepdims and len(result.shap... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_argmin.py", "license": "apache-2.0", "size": 1228} |
### File: onnx/reference/ops/op_asin.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Asin(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arcsin(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_asin.py", "license": "apache-2.0", "size": 251} |
### File: onnx/reference/ops/op_asinh.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Asinh(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arcsinh(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_asinh.py", "license": "apache-2.0", "size": 253} |
### File: onnx/reference/ops/op_atan.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Atan(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arctan(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_atan.py", "license": "apache-2.0", "size": 251} |
### File: onnx/reference/ops/op_atanh.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Atanh(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.arctanh(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_atanh.py", "license": "apache-2.0", "size": 253} |
### File: onnx/reference/ops/op_attribute_has_value.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class AttributeHasValue(OpRun):
def _run( # type: ignore
self,
value_float=None,
value_floa... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_attribute_has_value.py", "license": "apache-2.0", "size": 842} |
### File: onnx/reference/ops/op_average_pool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops.op_pool_common import CommonPool
class AveragePool_1(CommonPool):
def _run( # type: ignore
self,
x,
auto_pad=None,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_average_pool.py", "license": "apache-2.0", "size": 2486} |
### File: onnx/reference/ops/op_batch_normalization.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _batchnorm_test_mode(
x: np.ndarray,
s: np.ndarray,
bias: np.ndarray,
mean: np.ndarray,
var: np.... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_batch_normalization.py", "license": "apache-2.0", "size": 2977} |
### File: onnx/reference/ops/op_bernoulli.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.helper import np_dtype_to_tensor_dtype
from onnx.reference.ops._op_common_random import _CommonRandom
class Bernoulli(_CommonRandom):
def _run(self, x, dtype=None, seed=None): ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bernoulli.py", "license": "apache-2.0", "size": 558} |
### File: onnx/reference/ops/op_bitshift.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class BitShift(OpRunBinaryNumpy):
def __init__(self, onnx_node, run_params): # type: ignore
OpRunBinaryNum... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bitshift.py", "license": "apache-2.0", "size": 599} |
### File: onnx/reference/ops/op_bitwise_and.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinary
class BitwiseAnd(OpRunBinary):
def _run(self, x, y): # type: ignore
return (np.bitwise_and(x, y),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bitwise_and.py", "license": "apache-2.0", "size": 264} |
### File: onnx/reference/ops/op_bitwise_not.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnary
class BitwiseNot(OpRunUnary):
def _run(self, X):
return (np.bitwise_not(X),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bitwise_not.py", "license": "apache-2.0", "size": 240} |
### File: onnx/reference/ops/op_bitwise_or.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinary
class BitwiseOr(OpRunBinary):
def _run(self, x, y): # type: ignore
return (np.bitwise_or(x, y),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bitwise_or.py", "license": "apache-2.0", "size": 262} |
### File: onnx/reference/ops/op_bitwise_xor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinary
class BitwiseXor(OpRunBinary):
def _run(self, x, y): # type: ignore
return (np.bitwise_xor(x, y),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_bitwise_xor.py", "license": "apache-2.0", "size": 264} |
### File: onnx/reference/ops/op_blackman_window.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op_common_window import _CommonWindow
class BlackmanWindow(_CommonWindow):
"""
Returns
:math:`\\omega_n = 0.42 - 0.5 \\cos \\le... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_blackman_window.py", "license": "apache-2.0", "size": 908} |
### File: onnx/reference/ops/op_cast.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.helper import (
float32_to_bfloat16,
float32_to_float8e4m3,
float32_to_float8e5m2,
tensor_dtype_to_np_dtype,
)
from onnx.numpy_helper import (
bflo... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_cast.py", "license": "apache-2.0", "size": 3689} |
### File: onnx/reference/ops/op_cast_like.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.helper import np_dtype_to_tensor_dtype
from onnx.onnx_pb import TensorProto
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_cast import (
bfloat16,
cast_to... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_cast_like.py", "license": "apache-2.0", "size": 1346} |
### File: onnx/reference/ops/op_ceil.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Ceil(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.ceil(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_ceil.py", "license": "apache-2.0", "size": 249} |
### File: onnx/reference/ops/op_celu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _vcelu1(x: np.ndarray, alpha: float = 1.0) -> np.ndarray:
positive_input = np.maximum(0, x)
negative_input = np.minimum(0, ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_celu.py", "license": "apache-2.0", "size": 496} |
### File: onnx/reference/ops/op_center_crop_pad.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class CenterCropPad(OpRun):
def _run(self, input_data, shape, axes=None): # type: ignore
axes = axes or self.ax... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_center_crop_pad.py", "license": "apache-2.0", "size": 1608} |
### File: onnx/reference/ops/op_clip.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
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
amin = min
amax = max
if ami... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_clip.py", "license": "apache-2.0", "size": 832} |
### File: onnx/reference/ops/op_col2im.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops._op_common_indices import _get_indices, _is_out
def _col2im_shape_check_2d(X, output_shape, kernel_shape, dil... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_col2im.py", "license": "apache-2.0", "size": 8011} |
### File: onnx/reference/ops/op_compress.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Compress(OpRun):
def _run(self, x, condition, axis=None): # type: ignore
return (np.compress(condition, x, axis=... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_compress.py", "license": "apache-2.0", "size": 300} |
### File: onnx/reference/ops/op_concat.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Concat(OpRun):
def _preprocess(self, a: np.ndarray, axis: int) -> np.ndarray:
if len(a.shape) == 0:
rai... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_concat.py", "license": "apache-2.0", "size": 712} |
### File: onnx/reference/ops/op_concat_from_sequence.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Any, List
import numpy as np
from onnx.reference.op_run import OpRun
def _concat_from_sequence(seq: List[Any], axis: int, new_axis: int = 0) -> np.ndarray:
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_concat_from_sequence.py", "license": "apache-2.0", "size": 738} |
### File: onnx/reference/ops/op_constant.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.custom_element_types import (
bfloat16,
float8e4m3fn,
float8e4m3fnuz,
float8e5m2,
float8e5m2fnuz,
)
from onnx.reference.op_run import... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_constant.py", "license": "apache-2.0", "size": 5211} |
### File: onnx/reference/ops/op_constant_of_shape.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class ConstantOfShape(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__(self, ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_constant_of_shape.py", "license": "apache-2.0", "size": 1054} |
### File: onnx/reference/ops/op_conv.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _conv_implementation( # type: ignore
X, W, B, auto_pad, dilations, group, kernel_shape, pads, strides
):
if dilations is N... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_conv.py", "license": "apache-2.0", "size": 13172} |
### File: onnx/reference/ops/op_conv_integer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_conv import _conv_implementation
class ConvInteger(OpRun):
def _run( # type: ignore
sel... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_conv_integer.py", "license": "apache-2.0", "size": 1355} |
### File: onnx/reference/ops/op_conv_transpose.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_col2im import col2im_naive_implementation
class ConvTranspose(OpRun):
def _run( # type: ignor... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_conv_transpose.py", "license": "apache-2.0", "size": 4050} |
### File: onnx/reference/ops/op_cos.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Cos(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.cos(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_cos.py", "license": "apache-2.0", "size": 247} |
### File: onnx/reference/ops/op_cosh.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Cosh(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.cosh(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_cosh.py", "license": "apache-2.0", "size": 249} |
### File: onnx/reference/ops/op_cum_sum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class CumSum(OpRun):
def _run(self, x, *axis, exclusive=None, reverse=None): # type: ignore
axis = None if not axis els... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_cum_sum.py", "license": "apache-2.0", "size": 1652} |
### File: onnx/reference/ops/op_deform_conv.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _deform_conv_implementation( # type: ignore
X, W, offset, B, mask, dilations, group, kernel_shape, offset_group, pads,... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_deform_conv.py", "license": "apache-2.0", "size": 6206} |
### File: onnx/reference/ops/op_depth_to_space.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class DepthToSpace(OpRun):
def _run(self, data, blocksize=None, mode=None): # type: ignore
if len(data.shape) !=... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_depth_to_space.py", "license": "apache-2.0", "size": 1280} |
### File: onnx/reference/ops/op_dequantize_linear.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Optional, Tuple
import numpy as np
from onnx import TensorProto
from onnx.helper import np_dtype_to_tensor_dtype
from onnx.numpy_helper import float8e4m3_to_float3... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_dequantize_linear.py", "license": "apache-2.0", "size": 3610} |
### File: onnx/reference/ops/op_det.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Det(OpRun):
def _run(self, x): # type: ignore
return (np.linalg.det(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_det.py", "license": "apache-2.0", "size": 237} |
### File: onnx/reference/ops/op_dft.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 _fft(x: np.ndarray, fft_length: int, axis: int) -> np.ndarray:
"""Compute the FFT return the r... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_dft.py", "license": "apache-2.0", "size": 3757} |
### File: onnx/reference/ops/op_div.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Div(OpRunBinaryNumpy):
def __init__(self, onnx_node, run_params): # type: ignore
OpRunBinaryNumpy.__init_... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_div.py", "license": "apache-2.0", "size": 514} |
### File: onnx/reference/ops/op_dropout.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Optional, Tuple
import numpy as np
from numpy.random import RandomState # type: ignore
from onnx.reference.op_run import OpRun
def _dropout(
X: np.ndarray,
drop_p... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_dropout.py", "license": "apache-2.0", "size": 1878} |
### File: onnx/reference/ops/op_dynamic_quantize_linear.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class DynamicQuantizeLinear(OpRun):
def _run(self, x): # type: ignore
# args: x, y_scale, zero_point
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_dynamic_quantize_linear.py", "license": "apache-2.0", "size": 927} |
### File: onnx/reference/ops/op_einsum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Einsum(OpRun):
def _run(self, *args, equation=None): # type: ignore
if not isinstance(equation, str):
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_einsum.py", "license": "apache-2.0", "size": 612} |
### File: onnx/reference/ops/op_elu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Elu(OpRunUnaryNum):
def _run(self, x, alpha=None): # type: ignore
alpha = alpha or self.alpha # type: ignor... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_elu.py", "license": "apache-2.0", "size": 361} |
### File: onnx/reference/ops/op_equal.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryComparison
class Equal(OpRunBinaryComparison):
def _run(self, a, b): # type: ignore
return (np.equal(a, b),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_equal.py", "license": "apache-2.0", "size": 273} |
### File: onnx/reference/ops/op_erf.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from math import erf
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Erf(OpRunUnaryNum):
def __init__(self, onnx_node, run_params): # type: ignore
OpRunUna... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_erf.py", "license": "apache-2.0", "size": 450} |
### File: onnx/reference/ops/op_exp.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Exp(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.exp(x).astype(x.dtype),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_exp.py", "license": "apache-2.0", "size": 263} |
### File: onnx/reference/ops/op_expand.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def common_reference_implementation(data: np.ndarray, shape: np.ndarray) -> np.ndarray:
ones = np.ones(shape, dtype=data.dtype)
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_expand.py", "license": "apache-2.0", "size": 451} |
### File: onnx/reference/ops/op_eyelike.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.helper import tensor_dtype_to_np_dtype
from onnx.onnx_pb import TensorProto
from onnx.reference.op_run import OpRun
class EyeLike(OpRun):
def _run(self, data,... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_eyelike.py", "license": "apache-2.0", "size": 957} |
### File: onnx/reference/ops/op_flatten.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnary
class Flatten(OpRunUnary):
def _run(self, x, axis=None): # type: ignore
i = axis or self.axis # type: ignore
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_flatten.py", "license": "apache-2.0", "size": 433} |
### File: onnx/reference/ops/op_floor.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Floor(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.floor(x),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_floor.py", "license": "apache-2.0", "size": 251} |
### File: onnx/reference/ops/op_gather.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Gather(OpRun):
def _run(self, x, indices, axis=None): # type: ignore
if not x.flags["C_CONTIGUOUS"]:
x... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_gather.py", "license": "apache-2.0", "size": 687} |
### File: onnx/reference/ops/op_gather_elements.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def gather_numpy_2(self: np.ndarray, index: np.ndarray) -> np.ndarray:
res = []
for a, b in zip(self, index):
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_gather_elements.py", "license": "apache-2.0", "size": 1559} |
### File: onnx/reference/ops/op_gathernd.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Tuple
import numpy as np
from onnx.reference.op_run import OpRun
def _gather_nd_impl(
data: np.ndarray, indices: np.ndarray, batch_dims: int
) -> Tuple[np.ndarray]:
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_gathernd.py", "license": "apache-2.0", "size": 2017} |
### File: onnx/reference/ops/op_gemm.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _gemm00(a, b, c, alpha, beta): # type: ignore
o = np.dot(a, b) * alpha
if c is not None and beta != 0:
o += c * be... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_gemm.py", "license": "apache-2.0", "size": 1928} |
### File: onnx/reference/ops/op_global_average_pool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _global_average_pool(x: np.ndarray) -> np.ndarray:
axis = tuple(range(2, np.ndim(x)))
y = np.average(x, axis... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_global_average_pool.py", "license": "apache-2.0", "size": 485} |
### File: onnx/reference/ops/op_global_max_pool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _global_max_pool(x: np.ndarray) -> np.ndarray:
spatial_shape = np.ndim(x) - 2
y = x.max(axis=tuple(range(spatial... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_global_max_pool.py", "license": "apache-2.0", "size": 521} |
### File: onnx/reference/ops/op_greater.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryComparison
class Greater(OpRunBinaryComparison):
def _run(self, a, b): # type: ignore
return (np.greater(a, b),)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_greater.py", "license": "apache-2.0", "size": 277} |
### File: onnx/reference/ops/op_greater_or_equal.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryComparison
class GreaterOrEqual(OpRunBinaryComparison):
def _run(self, a, b): # type: ignore
return (np.... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_greater_or_equal.py", "license": "apache-2.0", "size": 290} |
### File: onnx/reference/ops/op_grid_sample.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numbers
from typing import List
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_resize import _get_all_coords
class GridSample(OpRun):
# ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_grid_sample.py", "license": "apache-2.0", "size": 13413} |
### File: onnx/reference/ops/op_gru.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class CommonGRU(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__(self, onnx_node, run_param... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_gru.py", "license": "apache-2.0", "size": 4083} |
### File: onnx/reference/ops/op_hamming_window.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op_common_window import _CommonWindow
class HammingWindow(_CommonWindow):
"""
Returns
:math:`\\omega_n = \\alpha - \\beta \\cos ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_hamming_window.py", "license": "apache-2.0", "size": 788} |
### File: onnx/reference/ops/op_hann_window.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op_common_window import _CommonWindow
class HannWindow(_CommonWindow):
"""
Returns
:math:`\\omega_n = \\sin^2\\left( \\frac{\\pi n}... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_hann_window.py", "license": "apache-2.0", "size": 667} |
### File: onnx/reference/ops/op_hard_sigmoid.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class HardSigmoid(OpRunUnaryNum):
def _run(self, x, alpha=None, beta=None): # type: ignore
alpha = alpha ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_hard_sigmoid.py", "license": "apache-2.0", "size": 430} |
### File: onnx/reference/ops/op_hardmax.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Hardmax(OpRunUnaryNum):
def _run(self, x, axis=None): # type: ignore
axis = axis or self.axis # type: i... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_hardmax.py", "license": "apache-2.0", "size": 509} |
### File: onnx/reference/ops/op_identity.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops._op import OpRunUnaryNum
class Identity(OpRunUnaryNum):
def _run(self, a): # type: ignore
if a is None:
return (None,)
return (a.copy(... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_identity.py", "license": "apache-2.0", "size": 280} |
### File: onnx/reference/ops/op_if.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 If(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/onnx", "path": "onnx/reference/ops/op_if.py", "license": "apache-2.0", "size": 2398} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.