repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
metrics | src/torchmetrics/utilities/checks.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 336 | 12,885 |
metrics | src/torchmetrics/utilities/enums.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 154 | 3,688 |
metrics | src/torchmetrics/utilities/prints.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 74 | 2,368 |
metrics | src/torchmetrics/utilities/imports.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 70 | 3,412 |
metrics | src/torchmetrics/utilities/compute.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 244 | 8,319 |
metrics | src/torchmetrics/multimodal/clip_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 264 | 10,941 |
metrics | src/torchmetrics/multimodal/lve.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 191 | 8,358 |
metrics | src/torchmetrics/multimodal/clip_iqa.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 274 | 11,924 |
metrics | src/torchmetrics/clustering/calinski_harabasz_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 129 | 5,357 |
metrics | src/torchmetrics/clustering/adjusted_mutual_info_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 129 | 5,389 |
metrics | src/torchmetrics/clustering/adjusted_rand_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 128 | 5,191 |
metrics | src/torchmetrics/clustering/cluster_accuracy.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 149 | 6,034 |
metrics | src/torchmetrics/clustering/__init__.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 45 | 1,794 |
metrics | src/torchmetrics/clustering/homogeneity_completeness_v_measure.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 330 | 12,969 |
metrics | src/torchmetrics/clustering/davies_bouldin_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 139 | 5,478 |
metrics | src/torchmetrics/clustering/dunn_index.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 130 | 5,014 |
metrics | src/torchmetrics/clustering/normalized_mutual_info_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 128 | 5,282 |
metrics | src/torchmetrics/clustering/fowlkes_mallows_index.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 123 | 4,619 |
metrics | src/torchmetrics/clustering/mutual_info_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 128 | 5,044 |
metrics | src/torchmetrics/clustering/rand_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 126 | 4,886 |
metrics | src/torchmetrics/detection/ciou.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 196 | 8,176 |
metrics | src/torchmetrics/detection/giou.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 191 | 7,899 |
metrics | src/torchmetrics/detection/diou.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 196 | 8,133 |
metrics | src/torchmetrics/detection/__init__.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 33 | 1,398 |
metrics | src/torchmetrics/detection/_mean_ap.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 989 | 43,130 |
metrics | src/torchmetrics/detection/panoptic_qualities.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 477 | 22,057 |
metrics | src/torchmetrics/detection/iou.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 313 | 13,195 |
metrics | src/torchmetrics/detection/_deprecated.py | .py | from collections.abc import Collection
from typing import Any
from torchmetrics.detection import ModifiedPanopticQuality, PanopticQuality
from torchmetrics.utilities.prints import _deprecated_root_import_class
class _ModifiedPanopticQuality(ModifiedPanopticQuality):
"""Wrapper for deprecated import.
>>> fro... | 64 | 2,359 |
metrics | src/torchmetrics/detection/mean_ap.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 690 | 33,109 |
metrics | src/torchmetrics/detection/helpers.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 798 | 36,145 |
metrics | src/torchmetrics/segmentation/generalized_dice.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 192 | 8,423 |
metrics | src/torchmetrics/segmentation/mean_iou.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 227 | 10,539 |
metrics | src/torchmetrics/segmentation/hausdorff_distance.py | .py | # Copyright The Lightning team.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 160 | 6,985 |
metrics | src/torchmetrics/segmentation/dice.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 201 | 9,079 |
metrics | src/torchmetrics/retrieval/ndcg.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 163 | 6,664 |
metrics | src/torchmetrics/retrieval/r_precision.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 138 | 5,627 |
metrics | src/torchmetrics/retrieval/reciprocal_rank.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 161 | 6,557 |
metrics | src/torchmetrics/retrieval/fall_out.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 200 | 8,186 |
metrics | src/torchmetrics/retrieval/precision_recall_curve.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 432 | 17,893 |
metrics | src/torchmetrics/retrieval/average_precision.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 161 | 6,567 |
metrics | src/torchmetrics/retrieval/__init__.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 38 | 1,566 |
metrics | src/torchmetrics/retrieval/auroc.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 165 | 7,001 |
metrics | src/torchmetrics/retrieval/precision.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 168 | 6,919 |
metrics | src/torchmetrics/retrieval/_deprecated.py | .py | from typing import Any, Optional
from torchmetrics.retrieval.average_precision import RetrievalMAP
from torchmetrics.retrieval.fall_out import RetrievalFallOut
from torchmetrics.retrieval.hit_rate import RetrievalHitRate
from torchmetrics.retrieval.ndcg import RetrievalNormalizedDCG
from torchmetrics.retrieval.precisi... | 279 | 9,222 |
metrics | src/torchmetrics/retrieval/hit_rate.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 162 | 6,538 |
metrics | src/torchmetrics/retrieval/recall.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 161 | 6,516 |
metrics | src/torchmetrics/retrieval/base.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 192 | 8,043 |
onnx | tools/pixi-shim.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Wrapper that runs a command via pixi if available, otherwise directly.
Usage: python tools/pixi-shim.py <command> [args...]
This allows non-pixi users to run pre-commit hooks by having the
required tools (ruff, mypy, clang-format, s... | 33 | 868 |
onnx | tools/pretty_clang_tidy.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""Thin wrapper around run-clang-tidy that filters noisy output."""
from __future__ import annotations
import re
import subprocess
import sys
NOISE = re.compile(
r"^\[|^\d+ warnings? generated\.|^Suppressed \d|^Use -header-filter"
... | 36 | 961 |
onnx | tools/check_namespace.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Check that C++ files do not hardcode the onnx namespace.
Other libraries that statically link with onnx can hide onnx symbols
in a private namespace, so the namespace should not be hardcoded.
"""
from __future__ import annotations
i... | 31 | 833 |
onnx | tools/gen_coverage_report.py | .py | #!/usr/bin/env python
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import argparse
import os
import shutil
import subprocess
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(os.path.basename(__file__))
parser.add... | 96 | 2,151 |
onnx | docs/docsgen/source/onnx_sphinx.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Automates the generation of ONNX operators."""
from __future__ import annotations
import difflib
import importlib
import inspect
import keyword
import os
import pathlib
import re
import shutil
import sys
import textwrap
from typing i... | 995 | 32,773 |
onnx | docs/docsgen/source/conf.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import sys
import warnings
import onnx
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
# -- Project information -----------------------------------------------------
author ... | 109 | 2,698 |
onnx | tests/python/node_shape_inference_test.py | .py | # SPDX-License-Identifier: Apache-2.0
# Copyright (c) ONNX Project Contributors
from __future__ import annotations
import pytest
import onnx.helper
import onnx.shape_inference
class TestNodeInference:
@pytest.mark.parametrize("op_type", ["GreaterOrEqual", "LessOrEqual"])
def test_comparison_op(self, op_typ... | 25 | 942 |
onnx | tests/python/training_tool_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx import TensorProto, helper, numpy_helper, shape_inference
class TestTrainingTool:
def test_training_info_proto(self) -> None:
# Inference graph.
... | 96 | 3,626 |
onnx | tests/python/checker_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
from typing import TYPE_CHECKING
import numpy as np
import pytest
import onnx.defs
import onnx.parser
from onnx import (
GraphProto,
SparseTensorProto,
TensorProto... | 1,605 | 67,412 |
onnx | tests/python/opaque_type_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""Illustrative example of using an Opaque type.
Opaque types allow a model to carry values whose internal representation is
not defined by the ONNX spec, but is instead understood only by the
producer/consumer of a custom domain's ops (mu... | 184 | 7,407 |
onnx | tests/python/external_data_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import pathlib
import shutil
import uuid
import warnings
from typing import TYPE_CHECKING, Any
import numpy as np
import pytest
import onnx
from onnx import (
ModelProto,
NodeProto,
... | 1,344 | 54,125 |
onnx | tests/python/reference_evaluator_model_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from __future__ import annotations
import numpy as np
import onnx
import onnx.helper as oh
import onnx.numpy_helper as onh
import onnx.reference as orf
def create_model():
"""The following model is equivalent ... | 125 | 3,825 |
onnx | tests/python/inliner_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
from onnx import checker, inliner, parser
class TestInliner:
def test_basic(self):
model = parser.parse_model(
"""
<ir_version: 8, opset_import: [ "" ... | 141 | 4,810 |
onnx | tests/python/model_container_test.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
import numpy as np
import pytest
import onnx
import onnx.external_data_helper as ext_data
import onnx.helper
import onnx.model_container
import onnx.numpy_helper
def _linea... | 134 | 5,059 |
onnx | tests/python/function_inference_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from shape_inference_test import TestShapeInferenceHelper
import onnx
import onnx.helper
import onnx.parser
import onnx.shape_inference
from onnx import A... | 122 | 4,525 |
onnx | tests/python/numpy_helper_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import pytest
import onnx
import onnx.reference
from onnx import helper, numpy_helper
class TestNumpyHelper:
def _test_numpy_helper_float_type(self, dtype: np.number) -> None:
... | 325 | 12,886 |
onnx | tests/python/model_inference_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import typing
import pytest
import onnx
import onnx.parser
import onnx.shape_inference
class TestModelInference:
def _check(self, model_text: str, *expected: int):
"""Check that the model... | 273 | 9,319 |
onnx | tests/python/symbolic_shape_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx.shape_inference
from onnx import ModelProto, TensorProto, TensorShapeProto, ValueInfoProto, helper
from onnx.helper import make_model, make_tensor_value_info
class TestSymbolicShape:
de... | 194 | 8,394 |
onnx | tests/python/serialization_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
import pytest
import onnx
_TEST_MODEL = """\
<
ir_version: 8,
opset_import: ["" : 17, "local" : 1]
>
agraph (float[N] X) => (float[N] Y) {
Y = local.foo (X)
}
<o... | 99 | 3,210 |
onnx | tests/python/model_container_refeval_test.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
import numpy as np
import numpy.testing as npt
import pytest
import onnx
import onnx.helper
import onnx.model_container
import onnx.numpy_helper
import onnx.reference
def _... | 137 | 4,893 |
onnx | tests/python/data_propagation_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
from shape_inference_test import TestShapeInferenceHelper
import onnx.parser
from onnx import TensorProto
from onnx.helper import make_node, make_tensor, make_tensor_value_info
class Te... | 335 | 12,236 |
onnx | tests/python/shape_inference_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import contextlib
from pathlib import Path
from typing import TYPE_CHECKING, Any
import numpy as np
import pytest
from google.protobuf import text_format
import onnx.shape_inference
from onnx import (... | 13,531 | 496,001 |
onnx | tests/python/reference_evaluator_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from __future__ import annotations
import importlib.util
import math
import warnings
from os import getenv
from textwrap import dedent
from typing import TYPE_CHECKING
import ml_dtypes
import numpy as np
import pyt... | 6,625 | 245,566 |
onnx | tests/python/parser_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import locale
import platform
import pytest
import onnx
from onnx import GraphProto, OperatorSetIdProto, TensorProto, checker
class TestBasicFunctions:
def check_graph(self, graph: GraphProto) ->... | 411 | 14,717 |
onnx | tests/python/basic_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import os
import pathlib
import tempfile
import google.protobuf.message
import google.protobuf.text_format
import pytest
import onnx
from onnx import serialization
def _simple_model() -> on... | 294 | 11,626 |
onnx | tests/python/version_converter_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import contextlib
import os
import struct
import tempfile
import numpy as np
import pytest
import onnx.version_converter
from onnx import (
GraphProto,
ModelProto,
OperatorSetIdProto,
T... | 3,217 | 123,122 |
onnx | tests/python/utils_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import os
import shutil
import tarfile
import tempfile
import pytest
import onnx
from onnx import TensorProto, helper
class TestUtilityFunctions:
def test_extract_model(self) -> None:
... | 80 | 2,830 |
onnx | tests/python/compose_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pytest
from onnx import (
FunctionProto,
GraphProto,
ModelProto,
NodeProto,
SparseTensorProto,
TensorProto,
ValueI... | 1,123 | 40,331 |
onnx | tests/python/reference_evaluator_ml_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from __future__ import annotations
import importlib
import itertools
import os
import numpy as np
import pytest
from numpy.testing import assert_allclose
import onnx
from onnx import ONNX_ML, TensorProto, TypeProto... | 2,354 | 87,916 |
onnx | tests/python/function_test.py | .py | # SPDX-License-Identifier: Apache-2.0
# Copyright (c) ONNX Project Contributors
from __future__ import annotations
import onnx
from onnx import checker, utils
class TestFunction:
def _verify_function_set(self, extracted_model, function_set, func_domain):
checker.check_model(extracted_model)
asse... | 222 | 8,523 |
onnx | tests/python/schema_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import contextlib
from typing import TYPE_CHECKING
import pytest
import onnx
from onnx import defs
if TYPE_CHECKING:
from collections.abc import Sequence
class TestSchema:
def test_get_schem... | 569 | 21,461 |
onnx | tests/python/version_utils.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from packaging.version import parse as version
def numpy_older_than(ver: str) -> bool:
"""Returns True if the numpy version is older than the given version."""
import numpy # noqa: PLC0415
... | 21 | 576 |
onnx | tests/python/inference_function_test.py | .py | # SPDX-License-Identifier: Apache-2.0
# Copyright (c) ONNX Project Contributors
from __future__ import annotations
import numpy as np
import pytest
import onnx
from onnx import TensorProto, TypeProto
from onnx.checker import ValidationError
from onnx.defs import OpSchema, get_all_schemas_with_history, get_schema
fro... | 299 | 10,239 |
onnx | tests/python/backend_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import platform
from typing import TYPE_CHECKING, Any
import onnx.backend.base
import onnx.backend.test
import onnx.shape_inference
import onnx.version_converter
from onnx import ModelP... | 121 | 3,985 |
onnx | tests/python/helper_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import random
from typing import Any
import ml_dtypes
import numpy as np
import pytest
from onnx import (
AttributeProto,
GraphProto,
ModelProto,
OptionalProto,
Sequence... | 1,173 | 44,142 |
onnx | tests/python/backend_reference_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import platform
import sys
from typing import Any
import numpy
import version_utils
import onnx.backend.base
import onnx.backend.test
from onnx import ModelProto
from onnx.backend.base import... | 185 | 7,031 |
onnx | tests/python/printer_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
import onnx
from onnx import parser, printer
class TestBasicFunctions:
def check_graph(self, graph: onnx.GraphProto) -> None:
assert len(graph.node) == 3
assert graph... | 90 | 3,499 |
onnx | tests/python/tools_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from numpy.testing import assert_allclose
import onnx
from onnx import TensorProto, helper, numpy_helper
from onnx.defs import onnx_opset_version
from onnx.reference import ReferenceE... | 322 | 13,407 |
onnx | tests/python/version_converter/automatic_conversion_test_base.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import string
from typing import TYPE_CHECKING, Any, cast
import pytest
import onnx
from onnx import TensorProto, ValueInfoProto, helper, shape_inference, version_converter
if TYPE_CHECKING:
from ... | 161 | 7,115 |
onnx | tests/python/version_converter/automatic_downgrade_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import automatic_conversion_test_base
import numpy as np
import pytest
import onnx
from onnx import helper
#####################################################################################
# Every ... | 131 | 4,448 |
onnx | tests/python/version_converter/automatic_upgrade_test.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import ClassVar
import automatic_conversion_test_base
import numpy as np
import onnx
from onnx import TensorProto, helper
##################################################################... | 2,116 | 65,164 |
onnx | onnx/inliner.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.inliner as C # noqa: N812
def inline_local_functions(
model: onnx.ModelProto, convert_version: bool = False
) -> onnx.ModelProto:
"""Inline model-l... | 61 | 2,106 |
onnx | onnx/external_data_helper.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import re
import sys
import uuid
import warnings
from itertools import chain
from typing import IO, TYPE_CHECKING
import onnx.checker as onnx_checker
import onnx.onnx_cpp2py_export.checker as... | 429 | 16,641 |
onnx | onnx/model_container.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Implements function make_large_model to easily create and save models
bigger than 2 Gb.
"""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING, Any
import numpy as np
import onnx
import onnx.ex... | 347 | 12,489 |
onnx | onnx/parser.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.parser as C # noqa: N812
class ParseError(Exception):
pass
def parse_model(model_text: str) -> onnx.ModelProto:
"""Parse a string to build a Model... | 74 | 1,892 |
onnx | onnx/utils.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tarfile
from collections import deque
from typing import TYPE_CHECKING
import onnx.checker
import onnx.helper
import onnx.shape_inference
if TYPE_CHECKING:
from onnx.onnx_pb impor... | 325 | 12,743 |
onnx | onnx/compose.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
from onnx import (
AttributeProto,
GraphProto,
ModelProto,
TensorProto,
checker,
helper,
utils,
)
if TYPE_CHECKING:
from collections.ab... | 757 | 27,494 |
onnx | onnx/_mapping.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import NamedTuple
import ml_dtypes
import numpy as np
from onnx.onnx_pb import TensorProto
class TensorDtypeMap(NamedTuple):
np_dtype: np.dtype
storage_dtype: int
name: str
... | 120 | 4,207 |
onnx | onnx/printer.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.printer as C # noqa: N812
def to_text(
proto: onnx.ModelProto | onnx.FunctionProto | onnx.GraphProto | onnx.NodeProto,
) -> str:
if isinstance(proto... | 22 | 755 |
onnx | onnx/version_converter.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""onnx version converter
This enables users to convert their models between different opsets within the
default domain ("" or "ai.onnx").
"""
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.version_convert... | 44 | 1,267 |
onnx | onnx/__init__.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
# Constants
"ONNX_ML",
"IR_VERSION",
"IR_VERSION_2017_10_10",
"IR_VERSION_2017_10_30",
"IR_VERSION_2017_11_3",
"IR_VERSION_2019_1_22",
"IR_VERSION_2019_3_18"... | 471 | 15,429 |
onnx | onnx/numpy_helper.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import sys
from typing import TYPE_CHECKING, Any
import ml_dtypes
import numpy as np
import numpy.typing as npt
import onnx.external_data_helper
from onnx import helper
if TYPE_CHECKING:
... | 663 | 22,186 |
onnx | onnx/shape_inference.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""onnx shape inference. Shape inference is not guaranteed to be
complete.
"""
from __future__ import annotations
import os
from typing import TYPE_CHECKING
import onnx
import onnx.onnx_cpp2py_export.shape_inference as C # noqa: N81... | 182 | 5,906 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.