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
coremltools
coremltools/converters/libsvm/__init__.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..._deps import _HAS_LIBSVM from . import _libsvm_converter, _libsvm_util if _HAS_LIBSVM: fro...
109
3,399
coremltools
coremltools/converters/libsvm/_libsvm_converter.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import coremltools as ct from coremltools import __version__ as ct_version from coremltools import proto...
200
7,189
coremltools
coremltools/converters/lightgbm/_tree_ensemble.py
.py
# Copyright (c) 2026, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as _np from ..._deps import _HAS_LIGHTGBM from ...models.tree_ensemble import TreeEnsemble...
265
10,119
coremltools
coremltools/converters/lightgbm/_tree.py
.py
# Copyright (c) 2026, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import coremltools as ct from coremltools import __version__ as ct_version from ._tree_ensemble import ...
94
2,913
coremltools
coremltools/converters/mil/input_types.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from enum import Enum from typing import Optional import numpy as np from coremltools import _logge...
650
23,255
coremltools
coremltools/converters/mil/debugging_utils.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from collections import OrderedDict from typing import List, Optional import coremltools...
203
7,908
coremltools
coremltools/converters/mil/testing_utils.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import itertools import os from functools import partial from pathlib import Path from typ...
816
30,622
coremltools
coremltools/converters/mil/__init__.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from .frontend.tensorflow.tf_op_registry import register_tf_op from .frontend.torch import register_...
44
879
coremltools
coremltools/converters/mil/_testing_utils.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools import proto def random_gen_input_feature_type(input_desc): ...
79
3,030
coremltools
coremltools/converters/mil/converter.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import tempfile as _tempfile import warnings as _warnings from typing import Optional, Text, Tuple i...
352
12,609
coremltools
coremltools/converters/mil/_deployment_compatibility.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from enum import IntEnum from coremltools import ( _SPECIFICATION_VERSION_IOS_13, _SPECIFICATIO...
181
6,426
coremltools
coremltools/converters/mil/test_inputs_outputs_shape.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import os import tempfile import numpy as _np import PIL.Image import pytest import c...
739
28,344
coremltools
coremltools/converters/mil/testing_reqs.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os from typing import List import numpy as np import pytest from attrs import define, field, v...
175
6,533
coremltools
coremltools/converters/mil/conftest.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause def pytest_make_parametrize_id(config, val, argname): ''' This function is a hook into pytes...
13
460
coremltools
coremltools/converters/mil/experimental/passes/generic_conv_scale_fusion.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from coremltools.converters.mil import Builder as mb from coremltools....
245
8,572
coremltools
coremltools/converters/mil/experimental/passes/generic_conv_bias_fusion.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from coremltools import _logger as logger from coremltools.converters....
368
12,523
coremltools
coremltools/converters/mil/experimental/passes/generic_linear_bias_fusion.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from coremltools.converters.mil import Builder as mb from coremltools....
134
4,994
coremltools
coremltools/converters/mil/experimental/passes/generic_pass_infrastructure.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import warnings from functools import partial from coremltools.converters.mil.mil i...
231
10,314
coremltools
coremltools/converters/mil/experimental/passes/generic_layernorm_instancenorm_pattern_fusion.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from coremltools.converters.mil import Builder as mb from coremltools....
458
21,031
coremltools
coremltools/converters/mil/experimental/passes/generic_conv_batchnorm_fusion.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from coremltools.converters.mil import Builder as mb from coremltools....
170
6,064
coremltools
coremltools/converters/mil/mil/utils.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from copy import deepcopy from typing import Any, Dict, List, Optional, Tuple from .operation import ...
189
6,067
coremltools
coremltools/converters/mil/mil/builder.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numbers from collections import defaultdict from typing import Any, Callable, List, Optional, ...
439
16,166
coremltools
coremltools/converters/mil/mil/scope.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from collections import defaultdict from enum import Enum from typing import Dict, List, ...
350
12,996
coremltools
coremltools/converters/mil/mil/__init__.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause SPACES = " " from .block import Block, Function, curr_block from .builder import Builder from .inpu...
34
822
coremltools
coremltools/converters/mil/mil/block.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from collections import Counter, OrderedDict from typing import List, Optional, Set, Tupl...
1,142
44,404
coremltools
coremltools/converters/mil/mil/input_type.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import OrderedDict from coremltools.converters.mil.mil import types from coremltool...
352
11,482
coremltools
coremltools/converters/mil/mil/operation.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import Any, Dict, Optional, Tuple import numpy as np from coremltools.converters.mil.mi...
632
23,609
coremltools
coremltools/converters/mil/mil/var.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from collections import defaultdict from typing import Dict, List, Optional, Tuple, Union...
481
15,745
coremltools
coremltools/converters/mil/mil/program.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import defaultdict from typing import Dict, List, Optional, Union import numpy as _...
466
18,651
coremltools
coremltools/converters/mil/mil/visitors/dot_visitor.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..var import Var def _get_input_vars(op, only_nonconst_vars=False): """ Return type : ...
207
6,100
coremltools
coremltools/converters/mil/mil/passes/pass_pipeline.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from __future__ import annotations from typing import Dict, List, Optional, Set, Text, Union from t...
509
22,024
coremltools
coremltools/converters/mil/mil/passes/pass_registry.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import inspect from typing import Dict, Optional, Text, Type from coremltools import _logger as logg...
66
2,275
coremltools
coremltools/converters/mil/mil/passes/__init__.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause # Import all frontend/backend passes to make sure they got registered. from coremltools.converters.mi...
52
1,617
coremltools
coremltools/converters/mil/mil/passes/graph_pass.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from abc import ABC, abstractmethod from typing import Callable, List, Optional, Text, Union from co...
75
2,756
coremltools
coremltools/converters/mil/mil/passes/helper.py
.py
# Copyright (c) 2021, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import Callable, List, Optional import numpy as np from coremltools.converters.mil.mil ...
148
4,186
coremltools
coremltools/converters/mil/mil/passes/tests/test_state_passes.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil._deployment_compatibility import AvailableTarget...
317
10,542
coremltools
coremltools/converters/mil/mil/passes/tests/test_cleanup_passes.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import itertools import unittest import numpy as np import pytest from mock import patch...
2,838
106,139
coremltools
coremltools/converters/mil/mil/passes/tests/test_reduce_transposes_pass.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import unittest import numpy as np import pytest from coremltools.converters.mil.mil import Builder...
1,968
78,845
coremltools
coremltools/converters/mil/mil/passes/tests/test_symbol_transform.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil import Build...
186
7,044
coremltools
coremltools/converters/mil/mil/passes/tests/test_optimize_linear_passes.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import itertools import numpy as np import pytest from coremltools.converters.mil.mil i...
325
11,192
coremltools
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools from typing import Tuple import numpy as np import parameterized import pytest from...
3,107
124,890
coremltools
coremltools/converters/mil/mil/passes/tests/test_lower_complex_dialect_ops.py
.py
# Copyright (c) 2022, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import numpy as np import pytest from coremltools import ComputeUnit from coremltools.c...
141
5,494
coremltools
coremltools/converters/mil/mil/passes/tests/test_gelu_sigmoid_pass.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Builder as mb from coremltools.convert...
161
5,675
coremltools
coremltools/converters/mil/mil/passes/tests/test_pass_pipeline.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np import pytest from coremltools.converters.mil.mil import Builder as mb from corem...
127
5,566
coremltools
coremltools/converters/mil/mil/passes/tests/test_passes.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import itertools import unittest from typing import Dict, Optional import numpy as np im...
7,823
288,619
coremltools
coremltools/converters/mil/mil/passes/defs/lower_complex_dialect_ops.py
.py
# Copyright (c) 2022, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause """ This file contains a pass for lowering complex dialect ops into core ops. Steps for adding a new...
652
23,884
coremltools
coremltools/converters/mil/mil/passes/defs/transformer.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import ClassVar, List, Tuple import numpy as np from coremltools.converters.mil.mil.pas...
186
7,413
coremltools
coremltools/converters/mil/mil/passes/defs/preprocess.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clausefrom import re import warnings from collections import OrderedDict from typing import Optional from c...
394
17,022
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_activation_quantization.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from coremlt...
295
10,282
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_conv.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from typing import List, Optional, Tuple import numpy as np from coremltools import _lo...
1,336
48,161
coremltools
coremltools/converters/mil/mil/passes/defs/randomize.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Builder as mb from coremltools.convert...
60
1,944
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_gelu_sigmoid.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.passes.g...
140
4,508
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_linear.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Block from coremltools.converters.mil....
413
15,021
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_quantization.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import List, Set, Tuple import numpy as np from coremltools.converters.mil._deployment_...
1,246
48,006
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_state.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import List from coremltools.converters.mil.mil import Block from coremltools.converter...
210
7,558
coremltools
coremltools/converters/mil/mil/passes/defs/symbol_transform.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import Dict, Set, Tuple from coremltools import _logger as logger from coremltools.conv...
342
16,676
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_normalization.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import List, Optional import numpy as np from coremltools import _logger as logger from...
1,077
43,704
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_elementwise_binary.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Block from coremltools.converters.mil....
504
17,517
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_activation.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure i...
694
26,138
coremltools
coremltools/converters/mil/mil/passes/defs/quantization.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from abc import abstractmethod from enum import Enum as _Enum from typing import Dict, Set, Text, Tup...
653
26,940
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_tensor_operation.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil._deployment_compatibility import AvailableTarget ...
1,175
41,896
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_repeat_ops.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy from collections import defaultdict from typing import List, Text, Tuple import numpy as...
1,826
76,787
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/remove_symbolic_reshape.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import _logger as logger from coremltools.converters.mil.mil import Builder as mb f...
96
3,848
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/expand_dynamic_linear.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Block from coremltools.converters.mil....
116
5,147
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/remove_redundant_ops.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import collections from typing import Dict, List import numpy as np from coremltools.converters.mil...
303
12,593
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/dead_code_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import _logger as logger from coremltools.converters.mil.mil import Program from co...
87
3,198
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/dedup_op_and_var_names.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import collections import itertools from coremltools.converters.mil.mil import Function from coremlt...
95
3,833
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/const_deduplication.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import hashlib from typing import Dict, List, Tuple, Union import numpy as np from coremltools.conv...
256
10,597
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/const_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import _logger as logger from coremltools.converters.mil.mil import Builder as mb fr...
122
4,797
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/noop_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import types from coremltools.converters.mil...
250
8,331
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/loop_invariant_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.passes....
167
6,794
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/fuse_reduce_mean.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.passes....
128
4,394
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/topological_reorder.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.passes....
177
7,958
coremltools
coremltools/converters/mil/mil/tests/test_programs.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np import pytest import coremltools as ct from coremltools import _logger as logger ...
2,103
82,245
coremltools
coremltools/converters/mil/mil/tests/test_debug.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import os import tempfile import numpy as np import pytest import coremltools as c...
382
13,646
coremltools
coremltools/converters/mil/mil/tests/test_block.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import copy import numpy as np import pytest from coremltools.converters.mil.mil import Builder as ...
556
17,705
coremltools
coremltools/converters/mil/mil/tests/test_types.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np import pytest from coremltools import ImageType, StateType, TensorType from corem...
118
5,138
coremltools
coremltools/converters/mil/mil/ops/registry.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import defaultdict from coremltools import _logger as logger from coremltools.conve...
192
8,946
coremltools
coremltools/converters/mil/mil/ops/helper.py
.py
# Copyright (c) 2022, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import Dict, Type from coremltools.converters.mil._deployment_compatibility import Avail...
37
1,581
coremltools
coremltools/converters/mil/mil/ops/tests/testing_utils.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import functools from typing import Dict, List, Optional import pytest import coremltools as ct fro...
234
8,686
coremltools
coremltools/converters/mil/mil/ops/tests/test_utils.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil.ops.defs._utils import ( aggregated_pad,...
267
8,066
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_elementwise_unary.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import scipy from coremltools.converters.mil.mil ...
660
23,802
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_linear.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import platform import numpy as np import pytest import coremltools as ct from core...
462
17,591
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_tensor_operation.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import logging import itertools import platform import numpy as np import pytest import coremltools...
1,745
59,223
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_elementwise_binary.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builder...
589
21,150
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_conv.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import coremltools as ct from coremltools._deps i...
1,016
34,245
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_scatter_gather.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import coremltools as ct from coremltools._deps i...
719
26,021
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_pool.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import coremltools as ct from coremltools.convert...
512
18,257
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_normalization.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import platform import numpy as np import pytest import coremltools as ct from cor...
857
30,287
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_recurrent.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import coremltools as ct from coremltools._deps i...
894
29,717
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_random.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
432
14,824
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_control_flow.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
616
19,842
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_image_resizing.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import functools import itertools import numpy as np import pytest import coremltools as ct from co...
554
18,498
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_reduction.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import scipy from coremltools.converters.mil.mil ...
344
13,779
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_activation.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import scipy import coremltools as ct from coreml...
1,081
37,742
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_tensor_transformation.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import time import numpy as np import pytest import coremltools as ct from coremlt...
1,883
62,521
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_transformers.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import torch import coremltools as ct from coreml...
420
14,358
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_compression.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import math import re from typing import List, Tuple import numpy as np import pyte...
1,973
77,988
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_states.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import platform import numpy as np import pytest from coremltools.converters.mil.mil...
342
10,028
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_recurrent.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import torch import coremltools as ct from coremltoo...
178
5,765