repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/UnsortedSegmentProdOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class UnsortedSegmentProdOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls...
1,390
33.775
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/PadOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class PadOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0)...
1,278
30.975
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/RankOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class RankOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
1,285
31.15
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/PackOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class PackOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
2,238
35.112903
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/UnsortedSegmentSumOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class UnsortedSegmentSumOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls,...
1,383
33.6
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SparseToDenseOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SparseToDenseOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf,...
1,918
36.627451
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SVDFOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SVDFOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
2,977
39.794521
123
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/__init__.py
# SPDX-License-Identifier: Apache-2.0
39
12.333333
37
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/ReverseV2Options.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ReverseV2Options(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, off...
1,320
32.025
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Conv3DOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Conv3DOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
5,468
41.726563
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Model.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Model(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): ...
10,602
39.469466
153
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/BatchToSpaceNDOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class BatchToSpaceNDOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf...
1,355
32.9
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SubGraph.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SubGraph(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): ...
7,308
38.085561
138
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/LeakyReluOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class LeakyReluOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, off...
1,792
34.156863
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/StridedSliceOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class StridedSliceOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, ...
3,945
40.536842
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/FloorModOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class FloorModOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offs...
1,313
31.85
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/CustomOptionsFormat.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite class CustomOptionsFormat(object): FLEXBUFFERS = 0
186
17.7
68
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/FullyConnectedOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class FullyConnectedOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf...
3,723
43.333333
123
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/UnpackOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class UnpackOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
2,188
34.306452
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/VariantSubType.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class VariantSubType(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offse...
3,696
37.113402
128
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/L2NormOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class L2NormOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
1,917
36.607843
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/LessOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class LessOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
1,285
31.15
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/TopKV2Options.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class TopKV2Options(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
1,299
31.5
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/CustomQuantization.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class CustomQuantization(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, o...
2,828
36.72
129
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SplitVOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SplitVOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
1,793
34.176471
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/TransposeConvOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class TransposeConvOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf,...
3,449
40.071429
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/DimensionMetadata.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class DimensionMetadata(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, of...
4,751
41.428571
150
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/MulOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class MulOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0)...
1,890
36.078431
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Operator.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Operator(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): ...
11,202
41.759542
177
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Int32Vector.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Int32Vector(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
2,737
35.506667
129
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/OneHotOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class OneHotOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
1,748
33.294118
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/ShapeOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ShapeOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=...
1,764
33.607843
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/EqualOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class EqualOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=...
1,292
31.325
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SquaredDifferenceOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SquaredDifferenceOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, ...
1,376
33.425
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/ResizeBilinearOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ResizeBilinearOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf...
2,482
39.048387
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/ResizeNearestNeighborOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ResizeNearestNeighborOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(c...
2,558
40.274194
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/UnsortedSegmentMinOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class UnsortedSegmentMinOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls,...
1,383
33.6
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Metadata.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Metadata(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): ...
2,190
34.33871
123
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Pool2DOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Pool2DOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset...
4,379
40.320755
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/FakeQuantOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class FakeQuantOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, off...
3,237
37.547619
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/CallOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class CallOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0...
1,768
33.686275
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/BucketizeOptions.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class BucketizeOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, off...
2,866
37.226667
141
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/SignatureDef.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SignatureDef(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=...
5,070
38.617188
147
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite/Padding.py
# SPDX-License-Identifier: Apache-2.0 # automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite class Padding(object): SAME = 0 VALID = 1
181
15.545455
68
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/late_rewriters/channel_order_rewriters.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.late_rewriters.channel_order_rewriters - contains rewriters for replacing ops with channel first/last versions """ from tf2onnx import utils, constants # pylint: disable=invalid-name,unused-argument,missing-docstring, unused-variable _CHANNELS_FIRST_OPS = [ "Av...
2,828
30.433333
119
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/late_rewriters/__init__.py
# SPDX-License-Identifier: Apache-2.0 """tf2onnx.late_rewriters module.""" from tf2onnx.late_rewriters.channel_order_rewriters import rewrite_channels_first, rewrite_channels_last __all__ = [ "rewrite_channels_first", "rewrite_channels_last", ]
257
20.5
104
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_nn.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_nn """ from tf2onnx.handler import tfl_op from tf2onnx.tflite_handlers.tfl_math import separate_fused_activation_function # pylint: disable=unused-argument,missing-docstring,unused-variable,pointless-string-statement,invalid-name @tfl_op(["TFL_TRANSPOSE_CONV"], tf_op...
6,508
40.724359
117
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_postprocess.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_postprocess """ import logging import numpy as np from onnx.onnx_pb import TensorProto from tf2onnx.handler import tfl_op from tf2onnx import utils from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint: disable=unused-argument,m...
8,264
56.395833
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_controlflow.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_controlflow """ import copy import numpy as np from onnx.onnx_pb import TensorProto from tf2onnx.handler import tfl_op from tf2onnx import utils from tf2onnx.tf_loader import find_function from tf2onnx.graph_builder import GraphBuilder from tf2onnx.onnx_opset.controlflo...
5,064
36.518519
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_math.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_math """ import logging import numpy as np from onnx.onnx_pb import TensorProto from tf2onnx.handler import tfl_op from tf2onnx import utils logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring,unused-variable,pointless-string-state...
11,984
42.423913
118
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/__init__.py
# SPDX-License-Identifier: Apache-2.0 """tf2onnx.tflite_handlers module""" from . import ( tfl_math, tfl_nn, tfl_controlflow, tfl_direct, tfl_tensor, tfl_postprocess, )
195
14.076923
37
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_tensor.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_tensor """ import logging import numpy as np from tf2onnx.handler import tfl_op from tf2onnx import utils logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring,unused-variable,pointless-string-statement,invalid-name @tfl_op(["TFL_C...
2,972
29.336735
107
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/tflite_handlers/tfl_direct.py
# SPDX-License-Identifier: Apache-2.0 """ tfl_direct """ from tf2onnx.handler import tfl_op # pylint: disable=unused-argument,missing-docstring,unused-variable,pointless-string-statement,invalid-name @tfl_op("TFL_ABS", tf_op="Abs") @tfl_op("TFL_ADD_N", tf_op="AddN") @tfl_op("TFL_ARG_MAX", tf_op="ArgMax") @tfl_op...
3,657
36.326531
107
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/custom_opsets/ms.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx mapping functions for ms domain. """ import numpy as np from onnx import onnx_pb from onnx.onnx_pb import TensorProto from tf2onnx import constants, utils from tf2onnx.handler import tf_op from tf2onnx.onnx_opset import controlflow from tf2onnx.onnx_opset.nn import c...
6,202
52.474138
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/custom_opsets/onnx_ml.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx mapping functions for onnx ml domain. """ import logging import numpy as np from onnx import TensorProto from onnx import numpy_helper from tf2onnx import constants from tf2onnx.handler import tf_op from tf2onnx import utils logger = logging.getLogger(__name__) # py...
4,761
42.688073
117
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/custom_opsets/string_ops.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx mapping functions for string ops using contrib ops domain. """ import io import json import logging import numpy as np from onnx.numpy_helper import to_array from onnx.onnx_pb import TensorProto from onnx.helper import make_attribute from tf2onnx import constants, hand...
10,264
45.659091
117
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/custom_opsets/__init__.py
# SPDX-License-Identifier: Apache-2.0 """ custom tf2onnx mapping functions. """ from . import ms from . import onnx_ml from . import string_ops
146
17.375
41
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/transpose_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Transpose Optimizer.""" from collections import defaultdict import numpy as np import onnx from tf2onnx.constants import NCHW_TO_NHWC, NHWC_TO_NCHW, NCDHW_TO_NDHWC, NDHWC_TO_NCDHW, TARGET_CHANNELS_LAST from .. import utils from .optimizer_base import GraphOptimizerBase # p...
47,506
45.897335
118
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/const_dequantize_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """const dequantize Optimizer. if a dequantize op's inputs are const we may be able to fold it through the next op """ from .optimizer_base import GraphOptimizerBase from .const_fold_optimizer import ConstFoldOptimizer # pylint: disable=logging-not-lazy,unused-argument,missi...
4,580
39.539823
111
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/global_pool_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """global pool optimizer Replaces ReduceMean and ReduceMax patterns with GlobalAveragePool and GlobalMaxPool """ from onnx import TensorProto from tf2onnx.graph_builder import GraphBuilder from .optimizer_base import GraphOptimizerBase # pylint: disable=logging-not-lazy,unus...
2,349
37.52459
95
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/reshape_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """reshape optimizer Finds reshape ops with computed shapes and attempts to replace them with constant shapes. Even if some of the dimensions are non-constant, they can often be replaced with -1 or 0. Specifically, optimizes the pattern: node -> shape -> [computation] -...
5,148
44.166667
118
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/merge_duplicated_nodes_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Merge Duplicated Nodes Optimizer. Remove duplicate nodes except identity nodes which should be handled by identity optimizer. for example, node a is input of node b and node c, and computation of node b, c are same such as "abs" op. then b and c can be merged into one...
4,973
40.107438
109
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/identity_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Identity Optimizer. Remove useless Identity node in graphs including subgraphs, but does not hurt model output names. """ from .optimizer_base import GraphOptimizerBase # pylint: disable=logging-not-lazy,unused-argument,missing-docstring,unused-variable,arguments-differ ...
3,079
35.666667
101
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/upsample_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Resize Optimizer. Replace resize operations with all ones in scale with Identity nodes """ import numpy as np from .optimizer_base import GraphOptimizerBase # pylint: disable=logging-not-lazy,unused-argument,missing-docstring,unused-variable,arguments-differ class Upsa...
1,893
35.423077
101
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/q_dq_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """q dq optimizer Pushes Quantize ops up and Dequantize ops down to maximize DQ -> op -> Q patterns for ORT Does not work for per-channel quantization yet """ from .optimizer_base import GraphOptimizerBase # pylint: disable=logging-not-lazy,unused-argument,missing-docstri...
6,665
41.730769
113
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/const_fold_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """const fold Optimizer. if op's inputs are all const then do op computation when building the graph to improve performance for example, input of transpose node is const then we can do transpose statically instead of at runtime """ import numpy as np from .. import utils f...
7,771
37.098039
111
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/back_to_back_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Back_To_Back Optimizer. Collapse consecutive nodes into 1 node if possible. """ import numpy as np from tf2onnx.utils import ONNX_DTYPE_NAMES # lgtm[py/unsafe-cyclic-import] from .optimizer_base import GraphOptimizerBase # lgtm[py/unsafe-cyclic-import] # pylint: disable...
10,687
38.439114
112
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/optimizer_base.py
# SPDX-License-Identifier: Apache-2.0 """Graph Optimizer Base""" import copy from .. import logging, utils class GraphOptimizerBase(object): """optimizer graph to improve performance """ def __init__(self): self._logger = logging.getLogger('.'.join(__name__.split('.')[:-1] + [self.__class__._...
2,281
28.636364
112
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/loop_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Loop Optimizer. some op in loop's body graph can be moved out of the loop """ from tf2onnx.utils import make_name, make_sure from .optimizer_base import GraphOptimizerBase # pylint: disable=logging-not-lazy,unused-argument,missing-docstring,unused-variable,arguments-diff...
4,114
43.247312
116
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/__init__.py
# SPDX-License-Identifier: Apache-2.0 """tf2onnx.optimizer module""" from collections import OrderedDict import copy from .const_fold_optimizer import ConstFoldOptimizer from .einsum_optimizer import EinsumOptimizer from .identity_optimizer import IdentityOptimizer from .merge_duplicated_nodes_optimizer import Merge...
3,417
38.744186
109
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/optimizer/einsum_optimizer.py
# SPDX-License-Identifier: Apache-2.0 """Rewrites operator einsum into simple ONNX operators. """ import math from itertools import permutations import numpy as np from onnx import helper, numpy_helper, TensorProto, AttributeProto from .. import utils from ..constants import OPSET_TO_IR_VERSION, PREFERRED_OPSET from ....
85,912
35.888364
95
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/reduction.py
# SPDX-License-Identifier: Apache-2.0 """ reduction """ import logging import numpy as np from onnx import onnx_pb, helper from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-doc...
17,824
49.639205
119
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/math.py
# SPDX-License-Identifier: Apache-2.0 """ math """ import logging import numpy as np from onnx import onnx_pb from tf2onnx import constants, utils from tf2onnx.handler import tf_op from tf2onnx.onnx_opset import common from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint:...
49,158
45.158685
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/misc.py
# SPDX-License-Identifier: Apache-2.0 """ misc """ import logging from tf2onnx.handler import tf_op logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring @tf_op(["CheckNumerics", "StopGradient"]) class MoveToIdent: @classmethod def version_1(cls, ctx, node, **kwargs): ...
1,087
23.177778
82
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/signal.py
# SPDX-License-Identifier: Apache-2.0 """ signal """ import logging import numpy as np from onnx import onnx_pb, helper from onnx.numpy_helper import to_array from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint: ...
47,164
47.029532
117
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/nn.py
# SPDX-License-Identifier: Apache-2.0 """ nn """ import logging import numpy as np from onnx import onnx_pb, helper from onnx.onnx_pb import TensorProto from tf2onnx import constants, utils from tf2onnx.graph_builder import GraphBuilder from tf2onnx.handler import tf_op from tf2onnx.onnx_opset import common, contro...
112,073
52.598278
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/common.py
# SPDX-License-Identifier: Apache-2.0 """ common """ import logging from tf2onnx import constants logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring class BroadcastOp: @classmethod def version_1(cls, ctx, node, **kwargs): """Elementwise Ops with broadcast fl...
2,487
36.69697
95
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/controlflow.py
# SPDX-License-Identifier: Apache-2.0 """ controlflow """ import copy import logging import numpy as np from onnx import onnx_pb from onnx.onnx_pb import TensorProto from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.tf_loader import find_function from tf2onnx.graph_builder import GraphBuilde...
35,445
43.197007
119
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/__init__.py
# SPDX-License-Identifier: Apache-2.0 """tf2onnx.onnx_opset module""" from . import ( common, controlflow, generator, logical, math, misc, nn, quantize, reduction, rnn, signal, tensor, traditionalml )
255
11.8
37
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/rnn.py
# SPDX-License-Identifier: Apache-2.0 """ rnn """ import logging import numpy as np from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring @tf_op("LSTMBlockCell") class LST...
11,785
44.330769
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/generator.py
# SPDX-License-Identifier: Apache-2.0 """ generator """ import logging import numpy as np from onnx import onnx_pb, numpy_helper, helper from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.graph_builder import GraphBuilder logger = logging.getLogger(__name__) # pylint: disable=unused-argumen...
12,828
43.237931
116
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/quantize.py
# SPDX-License-Identifier: Apache-2.0 """ tensor """ import logging import numpy as np from onnx.onnx_pb import TensorProto from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.utils import make_sure logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring,unu...
3,131
35.418605
107
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/tensor.py
# SPDX-License-Identifier: Apache-2.0 """ tensor """ import logging import sys import numpy as np from onnx import onnx_pb, helper from onnx.onnx_pb import TensorProto from tf2onnx import constants, utils from tf2onnx.graph_builder import GraphBuilder from tf2onnx.handler import tf_op from tf2onnx.onnx_opset impor...
212,476
51.723821
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/traditionalml.py
# SPDX-License-Identifier: Apache-2.0 """ traditional ml """ import logging logger = logging.getLogger(__name__)
117
9.727273
37
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/onnx_opset/logical.py
# SPDX-License-Identifier: Apache-2.0 """ logical """ import logging from onnx import TensorProto from tf2onnx import utils from tf2onnx.handler import tf_op from tf2onnx.onnx_opset import common logger = logging.getLogger(__name__) # pylint: disable=unused-argument,missing-docstring def _add_cast_to_inputs(gra...
5,955
35.993789
161
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/gru_tf2_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.gru_tf2_rewriter - Rewrites GRU pattern used by tf2. """ from tf2onnx.graph_matcher import GraphMatcher from tf2onnx.rewriter.rnn_utils import make_grucell_pattern, keras_gru_pattern from tf2onnx.tf_loader import find_function from tf2onnx.rewriter.unit_rnn_...
7,461
42.132948
103
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/lstm_rewriter_base.py
# SPDX-License-Identifier: Apache-2.0 # Temporary base class exclusive for LSTMs for stacked LSTM layer support. # Once GRU, BiLSTM, BiGRU re-writers will also be enhanced for stacked layer support # this will be combined with unit rnn base class. """ tf2onnx.rewriter.lstm_rewriter_base """ import logging from tf2...
7,531
38.851852
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/fused_op_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.fused_op_rewriter - rewrite tensorflow _Fused ops from grappler into other tf ops """ # pylint: disable=missing-docstring def rewrite_fused_ops(g, ops): for node in ops: if node.type in ["_FusedConv2D", "_FusedMatMul", "_FusedDepthwiseConv2dNa...
1,486
39.189189
98
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/cond_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.cond_rewriter """ import logging import traceback from collections import OrderedDict from enum import Enum from tf2onnx import utils logger = logging.getLogger(__name__) # pylint: disable=missing-docstring,unused-argument,broad-except class BranchType(...
13,336
39.051051
118
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/conv_dilations_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.conv_dilations_rewriter - Rewrites the patten used to represent dilations pat = SpaceToBatchND->DepthwiseConv2dNative->BatchToSpaceND """ import numpy as np from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher # pylint: disable=invalid-name,unused-...
6,395
43.727273
115
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/conv2d_with_add_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter - rewrite tensorflow subgraph to onnx conv2d op with BiasAdd """ from tf2onnx import logging from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher logger = logging.getLogger(__name__) # pylint: disable=missing-docstring def rewrite_biasadd_with_co...
1,939
35.603774
100
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/loop_rewriter_base.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.loop_rewriter_base """ import logging from collections import OrderedDict from tf2onnx import utils from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher from tf2onnx.utils import is_tf_loopcond_op, is_tf_tensor_array_op from tf2onnx.utils import is_...
22,856
44.98994
120
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/gru_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.gru_rewriter """ import logging import numpy as np from tf2onnx import utils from tf2onnx.graph_builder import GraphBuilder from tf2onnx.rewriter.rnn_utils import RNNUnitType, get_weights_from_const_node from tf2onnx.rewriter.unit_rnn_rewriter_base import U...
12,892
45.713768
116
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/ragged_variant_shape_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter - RaggedTensorToVariant -> Shape pattern """ import numpy as np from tf2onnx import utils from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher # pylint: disable=missing-docstring def rewrite_ragged_variant_shape(g, ops): pattern1 = \ ...
1,386
33.675
100
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/thresholded_relu_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter - rewrite tensorflow subgraph to onnx ThresholdedRelu op """ from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher # pylint: disable=missing-docstring def rewrite_thresholded_relu(g, ops): if g.opset < 10: return ops pattern = \ ...
1,652
34.934783
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/unit_rnn_rewriter_base.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.unit_rnn_rewriter_base """ import logging from tf2onnx.rewriter.loop_rewriter_base import LoopRewriterBase, Context from tf2onnx.rewriter.rnn_utils import REWRITER_RESULT, get_pattern, \ get_rnn_scope_name, parse_rnn_loop, seq_len_pattern0, seq_len_patt...
11,475
36.503268
114
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/leakyrelu_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter - rewrite tensorflow subgraph to onnx leakyrelu op """ from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher # pylint: disable=missing-docstring def rewrite_leakyrelu(g, ops): if g.opset < 6: return ops pattern = \ OpType...
1,547
31.93617
119
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/dropout_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter - rewrite tensorflow subgraph to onnx dropout op """ import numpy as np from tf2onnx import utils from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher from tf2onnx import logging logger = logging.getLogger(__name__) # pylint: disable=missing-docs...
4,194
39.336538
118
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/eye_rewriter.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.eye_rewriter - supports tf.eye """ from onnx import onnx_pb from tf2onnx.graph_builder import GraphBuilder from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher # pylint: disable=invalid-name,unused-argument,missing-docstring, unused-variable def ...
6,952
39.190751
116
py
tensorflow-onnx
tensorflow-onnx-main/tf2onnx/rewriter/rnn_utils.py
# SPDX-License-Identifier: Apache-2.0 """ tf2onnx.rewriter.rnn_utils - rnn support """ from collections import defaultdict from enum import Enum import logging import numpy as np from tf2onnx import utils from tf2onnx.graph_builder import GraphBuilder from tf2onnx.graph_matcher import OpTypePattern # pylint: disabl...
26,847
35.929849
118
py