tico 0.1.0.dev250909__py3-none-any.whl → 0.1.0.dev250911__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tico/__init__.py +1 -1
- tico/passes/cast_mixed_type_args.py +2 -0
- tico/serialize/operators/op_le.py +54 -0
- tico/utils/register_custom_op.py +6 -4
- tico/utils/validate_args_kwargs.py +12 -0
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/METADATA +1 -1
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/RECORD +11 -10
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/LICENSE +0 -0
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/WHEEL +0 -0
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/entry_points.txt +0 -0
- {tico-0.1.0.dev250909.dist-info → tico-0.1.0.dev250911.dist-info}/top_level.txt +0 -0
tico/__init__.py
CHANGED
@@ -41,6 +41,8 @@ ops_to_promote = {
|
|
41
41
|
torch.ops.aten.ge.Tensor: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
42
42
|
torch.ops.aten.gt.Scalar: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
43
43
|
torch.ops.aten.gt.Tensor: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
44
|
+
torch.ops.aten.le.Scalar: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
45
|
+
torch.ops.aten.le.Tensor: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
44
46
|
torch.ops.aten.mul.Tensor: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
45
47
|
torch.ops.aten.minimum.default: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
46
48
|
torch.ops.aten.ne.Scalar: ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT,
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
from typing import Dict, List, TYPE_CHECKING
|
16
|
+
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
import torch._ops
|
19
|
+
import torch.fx
|
20
|
+
import torch
|
21
|
+
from circle_schema import circle
|
22
|
+
|
23
|
+
from tico.serialize.circle_graph import CircleSubgraph
|
24
|
+
from tico.serialize.operators.hashable_opcode import OpCode
|
25
|
+
from tico.serialize.operators.node_visitor import NodeVisitor, register_node_visitor
|
26
|
+
from tico.serialize.operators.utils import create_builtin_operator, get_op_index
|
27
|
+
from tico.utils.validate_args_kwargs import LeArgs
|
28
|
+
|
29
|
+
|
30
|
+
@register_node_visitor
|
31
|
+
class LeVisitor(NodeVisitor):
|
32
|
+
target: List[torch._ops.OpOverload] = [
|
33
|
+
torch.ops.aten.le.Scalar,
|
34
|
+
torch.ops.aten.le.Tensor,
|
35
|
+
]
|
36
|
+
|
37
|
+
def __init__(self, op_codes: Dict[OpCode, int], graph: CircleSubgraph):
|
38
|
+
super().__init__(op_codes, graph)
|
39
|
+
|
40
|
+
def define_node(self, node: torch.fx.Node) -> circle.Operator.OperatorT:
|
41
|
+
args = LeArgs(*node.args, **node.kwargs) # type: ignore[arg-type]
|
42
|
+
input = args.input
|
43
|
+
other = args.other
|
44
|
+
|
45
|
+
op_index = get_op_index(
|
46
|
+
circle.BuiltinOperator.BuiltinOperator.LESS_EQUAL, self._op_codes
|
47
|
+
)
|
48
|
+
|
49
|
+
inputs = [input, other]
|
50
|
+
outputs = [node]
|
51
|
+
|
52
|
+
operator = create_builtin_operator(self.graph, op_index, inputs, outputs)
|
53
|
+
|
54
|
+
return operator
|
tico/utils/register_custom_op.py
CHANGED
@@ -31,9 +31,11 @@ def CircleResizeNearestNeighbor():
|
|
31
31
|
W_scale_factor = size[2] / W
|
32
32
|
if H_scale_factor != W_scale_factor:
|
33
33
|
raise RuntimeError("Scale factor of H and W should be same.")
|
34
|
-
|
35
|
-
|
34
|
+
permuted = torch.permute(input_, [0, 3, 1, 2])
|
35
|
+
resized = torch.nn.functional.interpolate(
|
36
|
+
permuted, scale_factor=H_scale_factor, mode="nearest"
|
36
37
|
)
|
38
|
+
return torch.permute(resized, [0, 2, 3, 1])
|
37
39
|
|
38
40
|
@register_fake("circle_custom::resize_nearest_neighbor")
|
39
41
|
def _(input_: torch.Tensor, size: List[int]):
|
@@ -631,7 +633,7 @@ def CircleInstanceNorm():
|
|
631
633
|
bias: Optional[torch.Tensor] = None,
|
632
634
|
running_mean: Optional[torch.Tensor] = None,
|
633
635
|
running_var: Optional[torch.Tensor] = None,
|
634
|
-
use_input_stats: bool =
|
636
|
+
use_input_stats: bool = True,
|
635
637
|
momentum: float = 0.1,
|
636
638
|
eps: float = 1e-05,
|
637
639
|
cudnn_enabled: bool = False,
|
@@ -639,7 +641,7 @@ def CircleInstanceNorm():
|
|
639
641
|
NHWC_to_NCHW = [0, 3, 1, 2]
|
640
642
|
NCHW_input = torch.ops.aten.permute.default(input_, NHWC_to_NCHW)
|
641
643
|
|
642
|
-
args = [NCHW_input, weight, bias, None, None,
|
644
|
+
args = [NCHW_input, weight, bias, None, None, True, momentum, eps, False]
|
643
645
|
NCHW_output = torch.ops.aten.instance_norm.default(*args)
|
644
646
|
NCHW_to_NHWC = [0, 2, 3, 1]
|
645
647
|
NHWC_output = torch.ops.aten.permute.default(NCHW_output, NCHW_to_NHWC)
|
@@ -563,6 +563,18 @@ class InstanceNormArgs:
|
|
563
563
|
cudnn_enabled: bool
|
564
564
|
|
565
565
|
|
566
|
+
@enforce_type
|
567
|
+
@dataclass
|
568
|
+
class LeArgs:
|
569
|
+
"""
|
570
|
+
le.Scalar(Tensor self, Scalar other) -> Tensor
|
571
|
+
le.Tensor(Tensor self, Tensor other) -> Tensor
|
572
|
+
"""
|
573
|
+
|
574
|
+
input: Union[torch.fx.Node, torch.Tensor, float, int]
|
575
|
+
other: Union[torch.fx.Node, torch.Tensor, float, int]
|
576
|
+
|
577
|
+
|
566
578
|
@enforce_type
|
567
579
|
@dataclass
|
568
580
|
class LeakyReluArgs:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tico/__init__.py,sha256=
|
1
|
+
tico/__init__.py,sha256=AFm5dss2XoBxl2mMxRFDadqde3-e57kBbQuWfN4B82E,1883
|
2
2
|
tico/pt2_to_circle.py,sha256=gu3MD4Iqc0zMZcCZ2IT8oGbyj21CTSbT3Rgd9s2B_9A,2767
|
3
3
|
tico/config/__init__.py,sha256=xZzCXjZ84qE-CsBi-dfaL05bqpQ3stKKfTXhnrJRyVs,142
|
4
4
|
tico/config/base.py,sha256=q5xMqGxTUZs4mFqt5c7i_y9U00fYgdMGl9nUqIVMlCo,1248
|
@@ -102,7 +102,7 @@ tico/interpreter/interpreter.py,sha256=tGbluCbrehTCqBu8mtGDNzby_ieJ2ry8_RH_eC0CQ
|
|
102
102
|
tico/passes/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
103
103
|
tico/passes/cast_aten_where_arg_type.py,sha256=QOaet85z23ad3s9c8md5r11q9dEw4-lfJqlpM7aiBic,7228
|
104
104
|
tico/passes/cast_clamp_mixed_type_args.py,sha256=m3_HpXLywWmWERfE5lM5PgvjBod7C4BWu_Q-TkRyO8k,5387
|
105
|
-
tico/passes/cast_mixed_type_args.py,sha256=
|
105
|
+
tico/passes/cast_mixed_type_args.py,sha256=Wd3sCDKJZwdb8GiMWKljm8X5CLFRd8eCz-dmWks15Hc,7763
|
106
106
|
tico/passes/const_prop_pass.py,sha256=hDxGgJNiRjsgOArdaoeAOcOOA-nKBvA1W1zcMZQA5yg,11531
|
107
107
|
tico/passes/convert_conv1d_to_conv2d.py,sha256=ktS3h158y9rg1sQiW8BZZbflV_dk_UdjBPQnuiOKyzg,5303
|
108
108
|
tico/passes/convert_layout_op_to_reshape.py,sha256=sCAFjkmVtiKjvDQSAgnjNBHl3_hWXJZElGDXQiTH-7s,2963
|
@@ -176,6 +176,7 @@ tico/serialize/operators/op_gt.py,sha256=JAVbtuAUNLYhtJycJJCEkYo9QAvmiK4lTMdw5yH
|
|
176
176
|
tico/serialize/operators/op_index.py,sha256=iDW2YSeUS_kLiWEaQ_MjrYpxZAFBbm7_GU_2B4SRe6c,3033
|
177
177
|
tico/serialize/operators/op_index_select.py,sha256=O2MXXWGnCgS8QG3DrWKdYKbl88VBVscmOuoGcgBEf_0,2522
|
178
178
|
tico/serialize/operators/op_instance_norm.py,sha256=5QvLefa74BrAPsTNYsi4Y7IB8d1wer4gtWantKo2nlQ,2940
|
179
|
+
tico/serialize/operators/op_le.py,sha256=Ok0i973iiI_xzuTPL_0XndowcDta7VgBv-dacis9JRQ,1889
|
179
180
|
tico/serialize/operators/op_leaky_relu.py,sha256=UJPoL7kAIp6nAjyDdda_afdOcMLHme7NE77b2y76exc,2160
|
180
181
|
tico/serialize/operators/op_linear.py,sha256=bw_mn2CiJy8CbpPevOV0PMPh0ZMWKAybLZ9cnIKJSsk,2527
|
181
182
|
tico/serialize/operators/op_log.py,sha256=1TKvH2lttdAHE0P84vcxmOvGBBRUs6D71Jrei7SdZHE,1827
|
@@ -239,20 +240,20 @@ tico/utils/padding.py,sha256=qKke-dJeeLHiRaePjDS66txrGyiYuipLVQeqLYad8uk,3349
|
|
239
240
|
tico/utils/passes.py,sha256=kGmDe__5cPaO6i5EDAoXSVe6yXEoX9hAny4ROb3ZEmQ,2409
|
240
241
|
tico/utils/pytree_utils.py,sha256=jrk3N6X6LiUnBCX_gM1K9nywbVAJBVnszlTAgeIeDUc,5219
|
241
242
|
tico/utils/record_input.py,sha256=QN-8D71G_WAX3QQQ5CIwbEfFJZTQ3CvL4wCMiVddua4,3894
|
242
|
-
tico/utils/register_custom_op.py,sha256=
|
243
|
+
tico/utils/register_custom_op.py,sha256=895SKZeXQzolK-mPG38cQC37Be76xUV_Ujw1k1ts9_w,28218
|
243
244
|
tico/utils/serialize.py,sha256=mEuusEzi82WFsz3AkowgWwxSLeo50JDxyOj6yYDQhEI,1914
|
244
245
|
tico/utils/signature.py,sha256=R2GV0alRpXEbZISqPKyxCUWbgDcsrQ2ovbVG3737IzA,9595
|
245
246
|
tico/utils/torch_compat.py,sha256=oc6PztVsXdHcQ3iaVR90wLLxrGaj6zFHWZ8K9rRS6q8,1795
|
246
247
|
tico/utils/trace_decorators.py,sha256=ddLIiKQfSaQrxgF1kNpwjFTQnXENzeSfcr1kuAW4jGI,3221
|
247
248
|
tico/utils/utils.py,sha256=aySftYnNTsqVAMcGs_3uX3-hz577a2cj4p1aVV-1XeQ,12747
|
248
|
-
tico/utils/validate_args_kwargs.py,sha256=
|
249
|
+
tico/utils/validate_args_kwargs.py,sha256=RhBOHShi7DRHpCV_j4UcACk6wz4b1SUTWKj494_6zCQ,27439
|
249
250
|
tico/utils/mx/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
250
251
|
tico/utils/mx/elemwise_ops.py,sha256=V6glyAHsVR1joqpsgnNytatCD_ew92xNWZ19UFDoMTA,10281
|
251
252
|
tico/utils/mx/formats.py,sha256=uzNWyu-1onUlwQfX5cZ6fZSUfHMRqorper7_T1k3jfk,3404
|
252
253
|
tico/utils/mx/mx_ops.py,sha256=RcfUTYVi-wilGB2sC35OeARdwDqnixv7dG5iyZ-fQT8,8555
|
253
|
-
tico-0.1.0.
|
254
|
-
tico-0.1.0.
|
255
|
-
tico-0.1.0.
|
256
|
-
tico-0.1.0.
|
257
|
-
tico-0.1.0.
|
258
|
-
tico-0.1.0.
|
254
|
+
tico-0.1.0.dev250911.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
|
255
|
+
tico-0.1.0.dev250911.dist-info/METADATA,sha256=xwLIBaymr4huU56zVBjWp4SD870bk3Gb9Npss9zH8zk,8450
|
256
|
+
tico-0.1.0.dev250911.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
257
|
+
tico-0.1.0.dev250911.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
|
258
|
+
tico-0.1.0.dev250911.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
|
259
|
+
tico-0.1.0.dev250911.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|