text stringlengths 24 1.04M | metadata stringlengths 233 497 |
|---|---|
### File: onnx/reference/ops/op_image_decoder.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import numpy as np
from onnx.reference.op_run import OpRun
class ImageDecoder(OpRun):
def _run(self, encoded: np.ndarray, pixel_format=... | {"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_image_decoder.py", "license": "apache-2.0", "size": 1076} |
### File: onnx/reference/ops/op_instance_normalization.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class InstanceNormalization(OpRun):
def _run(self, x, s, bias, epsilon=None): # type: ignore
dims_x = 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_instance_normalization.py", "license": "apache-2.0", "size": 628} |
### File: onnx/reference/ops/op_isinf.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class IsInf(OpRun):
def _run(self, data, detect_negative=None, detect_positive=None): # type: ignore
if detect_negative:
... | {"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_isinf.py", "license": "apache-2.0", "size": 550} |
### File: onnx/reference/ops/op_isnan.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnary
class IsNaN(OpRunUnary):
def _run(self, data): # type: ignore
return (np.isnan(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_isnan.py", "license": "apache-2.0", "size": 251} |
### File: onnx/reference/ops/op_layer_normalization.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 _layer_normalization(
X: np.ndarray,
W: np.ndarray,
B: np.ndarray,
axis: 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_layer_normalization.py", "license": "apache-2.0", "size": 2621} |
### File: onnx/reference/ops/op_leaky_relu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
def _leaky_relu(x: np.ndarray, alpha: float) -> np.ndarray:
sign = (x > 0).astype(x.dtype)
sign -= ((sign - 1) *... | {"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_leaky_relu.py", "license": "apache-2.0", "size": 527} |
### File: onnx/reference/ops/op_less.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryComparison
class Less(OpRunBinaryComparison):
def _run(self, a, b): # type: ignore
return (np.less(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_less.py", "license": "apache-2.0", "size": 271} |
### File: onnx/reference/ops/op_less_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 LessOrEqual(OpRunBinaryComparison):
def _run(self, a, b): # type: ignore
return (np.less_e... | {"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_less_or_equal.py", "license": "apache-2.0", "size": 284} |
### File: onnx/reference/ops/op_log.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Log(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.log(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_log.py", "license": "apache-2.0", "size": 263} |
### File: onnx/reference/ops/op_log_softmax.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.op_softmax import Softmax
class LogSoftmax(Softmax):
def _run(self, X): # type: ignore
Y = Softmax._run(self, X)[0]
np.log(... | {"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_log_softmax.py", "license": "apache-2.0", "size": 303} |
### File: onnx/reference/ops/op_loop.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Loop(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__(self, onnx_node, run_params)
... | {"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_loop.py", "license": "apache-2.0", "size": 3406} |
### File: onnx/reference/ops/op_lp_normalization.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class LpNormalization(OpRunUnaryNum):
def _run(self, x, axis=None, p=None): # type: ignore
axis = axi... | {"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_lp_normalization.py", "license": "apache-2.0", "size": 522} |
### File: onnx/reference/ops/op_lp_pool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops.op_pool_common import CommonPool
class LpPool(CommonPool):
def _run( # type: ignore
self,
x,
auto_pad=Non... | {"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_lp_pool.py", "license": "apache-2.0", "size": 1221} |
### File: onnx/reference/ops/op_lrn.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import math
import numpy as np
from onnx.reference.op_run import OpRun
class LRN(OpRun):
def _run(self, x, alpha=None, beta=None, bias=None, size=None): # type: ignore
if len(x.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_lrn.py", "license": "apache-2.0", "size": 872} |
### File: onnx/reference/ops/op_lstm.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
class CommonLSTM(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_lstm.py", "license": "apache-2.0", "size": 4761} |
### File: onnx/reference/ops/op_matmul.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNum
def numpy_matmul(a, b): # type: ignore
"""
Implements a matmul product. See :func:`np.matmul`.
Handles sparse ... | {"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_matmul.py", "license": "apache-2.0", "size": 647} |
### File: onnx/reference/ops/op_matmul_integer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class MatMulInteger(OpRun):
def _run(self, A, B, a_zero_point=None, b_zero_point=None): # type: ignore
A32 = A.a... | {"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_matmul_integer.py", "license": "apache-2.0", "size": 485} |
### File: onnx/reference/ops/op_max.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Max(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_max.py", "license": "apache-2.0", "size": 727} |
### File: onnx/reference/ops/op_max_pool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op_common_pool import CommonPool
class MaxPool(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_max_pool.py", "license": "apache-2.0", "size": 14266} |
### File: onnx/reference/ops/op_max_unpool.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class MaxUnpool(OpRun):
def _run(self, X, indices, output_shape=None, kernel_shape=None, pads=None, strides=None): # 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_max_unpool.py", "license": "apache-2.0", "size": 1813} |
### File: onnx/reference/ops/op_mean.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class Mean(OpRun):
def _run(self, *args): # type: ignore
res = args[0].copy()
for m in args[1:]:
res += m
return (... | {"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_mean.py", "license": "apache-2.0", "size": 322} |
### File: onnx/reference/ops/op_mel_weight_matrix.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.reference.op_run import OpRun
class MelWeightMatrix(OpRun):
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/op_mel_weight_matrix.py", "license": "apache-2.0", "size": 2335} |
### File: onnx/reference/ops/op_min.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Min(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_min.py", "license": "apache-2.0", "size": 727} |
### File: onnx/reference/ops/op_mod.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Mod(OpRun):
def _run(self, a, b, fmod=None): # type: ignore
fmod = fmod or self.fmod # type: ignore
if fmod ... | {"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_mod.py", "license": "apache-2.0", "size": 496} |
### File: onnx/reference/ops/op_mul.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Mul(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_mul.py", "license": "apache-2.0", "size": 325} |
### File: onnx/reference/ops/op_neg.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Neg(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.negative(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_neg.py", "license": "apache-2.0", "size": 252} |
### File: onnx/reference/ops/op_negative_log_likelihood_loss.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _compute_negative_log_likelihood_loss(x, target, weight=None, reduction="mean", ignore_index=None): # type... | {"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_negative_log_likelihood_loss.py", "license": "apache-2.0", "size": 2894} |
### File: onnx/reference/ops/op_non_max_suppression.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import dataclasses
from typing import Optional, Tuple
import numpy as np
from onnx.reference.op_run import OpRun
@dataclasses.dataclass
class PrepareContext:
boxes_data_: Opt... | {"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_non_max_suppression.py", "license": "apache-2.0", "size": 9403} |
### File: onnx/reference/ops/op_non_zero.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class NonZero(OpRun):
def _run(self, x): # type: ignore
# Specify np.int64 for Windows x86 machines
res = np.v... | {"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_non_zero.py", "license": "apache-2.0", "size": 336} |
### File: onnx/reference/ops/op_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 Not(OpRunUnary):
def _run(self, x): # type: ignore
return (np.logical_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_not.py", "license": "apache-2.0", "size": 249} |
### File: onnx/reference/ops/op_one_hot.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _one_hot(indices, depth, axis=-1, dtype=np.float32): # type: ignore
values = np.asarray(indices)
rank = len(values.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_one_hot.py", "license": "apache-2.0", "size": 939} |
### File: onnx/reference/ops/op_optional.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.helper import tensor_dtype_to_np_dtype
from onnx.reference.op_run import OpRun
class Optional(OpRun):
def _run(self, x=None, type=None): # type: ignore
if x is not 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_optional.py", "license": "apache-2.0", "size": 543} |
### File: onnx/reference/ops/op_optional_get_element.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class OptionalGetElement(OpRun):
def _run(self, x): # type: ignore
if x is None:
raise ValueError("The requested 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/op_optional_get_element.py", "license": "apache-2.0", "size": 314} |
### File: onnx/reference/ops/op_optional_has_element.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class OptionalHasElement(OpRun):
def _run(self, x=None): # type: ignore
return (np.array(x is not 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_optional_has_element.py", "license": "apache-2.0", "size": 264} |
### File: onnx/reference/ops/op_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 Or(OpRunBinary):
def _run(self, x, y): # type: ignore
return (np.logical_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_or.py", "license": "apache-2.0", "size": 255} |
### File: onnx/reference/ops/op_pad.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _pad_impl(data, raw_pads, mode, constant_values=0.0, axes=None): # type: ignore
input_rank = data.ndim
if axes is 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_pad.py", "license": "apache-2.0", "size": 2050} |
### File: onnx/reference/ops/op_pool_common.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
import itertools
import math
from typing import Sequence, Tuple, Union
import numpy as np
from onnx.reference.op_run import OpRun
def get_pad_shape(
auto_pad: 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_pool_common.py", "license": "apache-2.0", "size": 12014} |
### File: onnx/reference/ops/op_pow.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from warnings import catch_warnings, simplefilter
import numpy as np
from onnx.reference.op_run import OpRun
class Pow(OpRun):
def _run(self, a, b): # type: ignore
with catch_warnin... | {"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_pow.py", "license": "apache-2.0", "size": 375} |
### File: onnx/reference/ops/op_prelu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class PRelu(OpRun):
def _run(self, x, slope): # type: ignore
try:
return (np.where(x > 0, x, x * slope).astyp... | {"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_prelu.py", "license": "apache-2.0", "size": 1159} |
### File: onnx/reference/ops/op_qlinear_conv.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 QLinearConv(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_qlinear_conv.py", "license": "apache-2.0", "size": 1990} |
### File: onnx/reference/ops/op_qlinear_matmul.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class QLinearMatMul(OpRun):
def _run( # type: ignore
self, a, a_scale, a_zero_point, b, b_scale, b_zero_point, 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_qlinear_matmul.py", "license": "apache-2.0", "size": 776} |
### File: onnx/reference/ops/op_quantize_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 (
float32_to_float8e4m3,
float32_to_float8e5m2,
np_dtype_to_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/op_quantize_linear.py", "license": "apache-2.0", "size": 4747} |
### File: onnx/reference/ops/op_random_normal.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops._op_common_random import _CommonRandom
class RandomNormal(_CommonRandom):
def _run(self, dtype=None, mean=None, scale=None, seed=None, shape=None): # 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_random_normal.py", "license": "apache-2.0", "size": 542} |
### File: onnx/reference/ops/op_random_normal_like.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 RandomNormalLike(_CommonRandom):
def _run(self, x, dtype=No... | {"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_random_normal_like.py", "license": "apache-2.0", "size": 642} |
### File: onnx/reference/ops/op_random_uniform.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.ops._op_common_random import _CommonRandom
class RandomUniform(_CommonRandom):
def _run(self, dtype=None, high=None, low=None, seed=None, shape=None): # 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_random_uniform.py", "license": "apache-2.0", "size": 531} |
### File: onnx/reference/ops/op_random_uniform_like.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 RandomUniformLike(_CommonRandom):
def _run(self, 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_random_uniform_like.py", "license": "apache-2.0", "size": 644} |
### File: onnx/reference/ops/op_range.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Range(OpRun):
def _run(self, starts, ends, steps): # type: ignore
return (np.arange(starts, ends, steps).astype(sta... | {"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_range.py", "license": "apache-2.0", "size": 292} |
### File: onnx/reference/ops/op_reciprocal.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Reciprocal(OpRunUnaryNum):
def _run(self, x): # type: ignore
with np.errstate(divide="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_reciprocal.py", "license": "apache-2.0", "size": 324} |
### File: onnx/reference/ops/op_reduce_l1.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceL1_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
axes =... | {"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_reduce_l1.py", "license": "apache-2.0", "size": 1237} |
### File: onnx/reference/ops/op_reduce_l2.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceL2_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
axes =... | {"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_reduce_l2.py", "license": "apache-2.0", "size": 1261} |
### File: onnx/reference/ops/op_reduce_log_sum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceLogSum_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=True): # 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_reduce_log_sum.py", "license": "apache-2.0", "size": 1190} |
### File: onnx/reference/ops/op_reduce_log_sum_exp.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
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)
da... | {"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_reduce_log_sum_exp.py", "license": "apache-2.0", "size": 1396} |
### File: onnx/reference/ops/op_reduce_max.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceMax_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
axes... | {"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_reduce_max.py", "license": "apache-2.0", "size": 1707} |
### File: onnx/reference/ops/op_reduce_mean.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceMean_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
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_reduce_mean.py", "license": "apache-2.0", "size": 1416} |
### File: onnx/reference/ops/op_reduce_min.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceMin_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
axes... | {"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_reduce_min.py", "license": "apache-2.0", "size": 1749} |
### File: onnx/reference/ops/op_reduce_prod.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceProd_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # type: ignore
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_reduce_prod.py", "license": "apache-2.0", "size": 1168} |
### File: onnx/reference/ops/op_reduce_sum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceSum_1(OpRunReduceNumpy):
def _run(self, x, axes=None, keepdims=None): # type: ignore
axes = ... | {"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_reduce_sum.py", "license": "apache-2.0", "size": 1324} |
### File: onnx/reference/ops/op_reduce_sum_square.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceSumSquare_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None): # 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_reduce_sum_square.py", "license": "apache-2.0", "size": 1179} |
### File: onnx/reference/ops/op_regex_full_match.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
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):
try:
... | {"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_regex_full_match.py", "license": "apache-2.0", "size": 1026} |
### File: onnx/reference/ops/op_relu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Relu(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.maximum(x, 0).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_relu.py", "license": "apache-2.0", "size": 271} |
### File: onnx/reference/ops/op_reshape.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def reshape_reference_implementation(
data: np.ndarray, shape: np.ndarray, allowzero: int = 0
) -> np.ndarray:
# replace zer... | {"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_reshape.py", "license": "apache-2.0", "size": 1140} |
### File: onnx/reference/ops/op_resize.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any, Callable
import numpy as np
from onnx.reference.op_run import OpRun
def _cartesian(arrays: list[np.ndarray], out: np.ndarray | 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_resize.py", "license": "apache-2.0", "size": 15609} |
### File: onnx/reference/ops/op_reverse_sequence.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class ReverseSequence(OpRun):
def _run(self, data, sequence_lens, batch_axis=None, time_axis=None): # type: ignore
index = [slice(... | {"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_reverse_sequence.py", "license": "apache-2.0", "size": 735} |
### File: onnx/reference/ops/op_rnn.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class CommonRNN(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_rnn.py", "license": "apache-2.0", "size": 4931} |
### File: onnx/reference/ops/op_roi_align.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
class PreCalc:
def __init__(self, pos1=0, pos2=0, pos3=0, pos4=0, w1=0, w2=0, w3=0, w4=0): # type: ... | {"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_roi_align.py", "license": "apache-2.0", "size": 10971} |
### File: onnx/reference/ops/op_round.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Round(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.round(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_round.py", "license": "apache-2.0", "size": 267} |
### File: onnx/reference/ops/op_scan.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Scan(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__(self, onnx_node, run_params)
... | {"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_scan.py", "license": "apache-2.0", "size": 5149} |
### File: onnx/reference/ops/op_scatter_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 scatter_elements(data, indices, updates, axis=0, reduction=None): # type: ignore
"""
::
// for 3-dim a... | {"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_scatter_elements.py", "license": "apache-2.0", "size": 4623} |
### File: onnx/reference/ops/op_scatternd.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def _scatter_nd_impl(data, indices, updates, reduction=None): # type: ignore
output = np.copy(data)
for i in np.ndindex(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_scatternd.py", "license": "apache-2.0", "size": 974} |
### File: onnx/reference/ops/op_selu.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Selu(OpRun):
def _run(self, x, alpha=None, gamma=None): # type: ignore
return (
(np.where(x > 0, x, np.e... | {"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_selu.py", "license": "apache-2.0", "size": 339} |
### File: onnx/reference/ops/op_sequence_at.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class SequenceAt(OpRun):
def _run(self, seq, index): # type: ignore
return (seq[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_sequence_at.py", "license": "apache-2.0", "size": 227} |
### File: onnx/reference/ops/op_sequence_construct.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class SequenceConstruct(OpRun):
def _run(self, *data): # type: ignore
return (list(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_sequence_construct.py", "license": "apache-2.0", "size": 229} |
### File: onnx/reference/ops/op_sequence_empty.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class SequenceEmpty(OpRun):
def _run(self, dtype=None): # type: ignore
return ([],)
| {"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_sequence_empty.py", "license": "apache-2.0", "size": 222} |
### File: onnx/reference/ops/op_sequence_erase.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class SequenceErase(OpRun):
def _run(self, S, ind=None): # type: ignore
if ind is None:
ind = -1
else:
... | {"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_sequence_erase.py", "license": "apache-2.0", "size": 351} |
### File: onnx/reference/ops/op_sequence_insert.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Any, List, Optional, Union
import numpy as np
from onnx.reference.op_run import OpRun
def sequence_insert_reference_implementation(
sequence: Union[List[Any], ... | {"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_sequence_insert.py", "license": "apache-2.0", "size": 1810} |
### File: onnx/reference/ops/op_sequence_length.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class SequenceLength(OpRun):
def _run(self, input_sequence): # type: ignore
if not isinstance(input_sequence, l... | {"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_sequence_length.py", "license": "apache-2.0", "size": 459} |
### File: onnx/reference/ops/op_sequence_map.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class SequenceMap(OpRun):
def _run(self, input_sequence, *additional_inputs, body=None, attributes=None): # type: ignore
if len(additi... | {"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_sequence_map.py", "license": "apache-2.0", "size": 1203} |
### File: onnx/reference/ops/op_shape.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Optional, Tuple
import numpy as np
from onnx.reference.op_run import OpRun
class Shape_1(OpRun):
def _run(self, data): # type: ignore
return (np.array(data.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_shape.py", "license": "apache-2.0", "size": 1128} |
### File: onnx/reference/ops/op_shrink.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Shrink(OpRun):
def _run(self, x, bias=None, lambd=None): # type: ignore
return (
np.where(
... | {"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_shrink.py", "license": "apache-2.0", "size": 412} |
### File: onnx/reference/ops/op_sigmoid.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
def sigmoid(x): # type: ignore
if x > 0:
return 1 / (1 + np.exp(-x))
return np.exp(x) / (1 + np.exp(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_sigmoid.py", "license": "apache-2.0", "size": 682} |
### File: onnx/reference/ops/op_sign.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Sign(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.sign(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_sign.py", "license": "apache-2.0", "size": 249} |
### File: onnx/reference/ops/op_sin.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Sin(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.sin(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_sin.py", "license": "apache-2.0", "size": 247} |
### File: onnx/reference/ops/op_sinh.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Sinh(OpRunUnaryNum):
def _run(self, x): # type: ignore
return (np.sinh(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_sinh.py", "license": "apache-2.0", "size": 249} |
### File: onnx/reference/ops/op_size.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Size(OpRun):
def _run(self, data): # type: ignore
return (np.array(data.size, dtype=np.int64),)
| {"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_size.py", "license": "apache-2.0", "size": 260} |
### File: onnx/reference/ops/op_slice.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
import numpy as np
from onnx.reference.ops._op import OpRun
def _slice(
data: np.ndarray,
starts: np.ndarray,
ends: np.ndarray,
axes: Optional[np.nd... | {"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_slice.py", "license": "apache-2.0", "size": 2394} |
### File: onnx/reference/ops/op_softmax.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Softmax(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_softmax.py", "license": "apache-2.0", "size": 464} |
### File: onnx/reference/ops/op_softmax_cross_entropy_loss.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
def softmaxcrossentropy( # type: ignore
x, target, weight=None, reduction="mean", ignore_index=None, get_log... | {"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_softmax_cross_entropy_loss.py", "license": "apache-2.0", "size": 2964} |
### File: onnx/reference/ops/op_softplus.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Softplus(OpRunUnaryNum):
def _run(self, X): # type: ignore
tmp = np.exp(X).astype(X.dtype)
tmp ... | {"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_softplus.py", "license": "apache-2.0", "size": 332} |
### File: onnx/reference/ops/op_softsign.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Softsign(OpRunUnaryNum):
def _run(self, X): # type: ignore
tmp = np.abs(X)
tmp += 1
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_softsign.py", "license": "apache-2.0", "size": 322} |
### File: onnx/reference/ops/op_space_to_depth.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class SpaceToDepth(OpRun):
def _run(self, data, blocksize=None): # type: ignore
if len(data.shape) != 4:
... | {"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_space_to_depth.py", "license": "apache-2.0", "size": 865} |
### File: onnx/reference/ops/op_split.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class CommonSplit(OpRun):
def __init__(self, onnx_node, run_params): # type: ignore
OpRun.__init__(self, onnx_node, run_params)
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_split.py", "license": "apache-2.0", "size": 1629} |
### File: onnx/reference/ops/op_split_to_sequence.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import List, Optional, Tuple
import numpy as np
from onnx.reference.op_run import OpRun
class SplitToSequence(OpRun):
def common_run(
self, mat: 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_split_to_sequence.py", "license": "apache-2.0", "size": 1498} |
### File: onnx/reference/ops/op_sqrt.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from warnings import catch_warnings, simplefilter
import numpy as np
from onnx.reference.ops._op import OpRunUnaryNum
class Sqrt(OpRunUnaryNum):
def _run(self, x): # type: ignore
w... | {"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_sqrt.py", "license": "apache-2.0", "size": 386} |
### File: onnx/reference/ops/op_squeeze.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
class Squeeze_1(OpRun):
def _run(self, data, axes=None): # type: ignore
if isinstance(axes, np.ndarray):
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_squeeze.py", "license": "apache-2.0", "size": 1168} |
### File: onnx/reference/ops/op_stft.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_concat_from_sequence import _concat_from_sequence
from onnx.reference.ops.op_dft import _cfft as _dft
from onn... | {"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_stft.py", "license": "apache-2.0", "size": 5547} |
### File: onnx/reference/ops/op_string_concat.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.op_run import OpRun
_acceptable_str_dtypes = ("U", "O")
class StringConcat(OpRun):
def _run(self, x, y):
if (
x.dtype.kin... | {"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_string_concat.py", "license": "apache-2.0", "size": 674} |
### File: onnx/reference/ops/op_string_normalizer.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import locale as pylocale
import unicodedata
import warnings
import numpy as np
from onnx.reference.op_run import OpRun, RuntimeTypeError
class StringNormalizer(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_string_normalizer.py", "license": "apache-2.0", "size": 4993} |
### File: onnx/reference/ops/op_string_split.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from typing import Union
import numpy as np
from onnx.reference.op_run import OpRun
_acceptable_str_dtypes = ("U", "O")
def pad_empty_string(
split_lists: Union[list, 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_string_split.py", "license": "apache-2.0", "size": 1594} |
### File: onnx/reference/ops/op_sub.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNumpy
class Sub(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_sub.py", "license": "apache-2.0", "size": 325} |
### File: onnx/reference/ops/op_sum.py
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from onnx.reference.op_run import OpRun
class Sum(OpRun):
def _run(self, *args): # type: ignore
return (sum(args).astype(args[0].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_sum.py", "license": "apache-2.0", "size": 236} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.