tico 0.1.0.dev250618__py3-none-any.whl → 0.1.0.dev250619__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 CHANGED
@@ -21,7 +21,7 @@ from tico.config import CompileConfigV1, get_default_config
21
21
  from tico.utils.convert import convert, convert_from_exported_program, convert_from_pt2
22
22
 
23
23
  # THIS LINE IS AUTOMATICALLY GENERATED BY setup.py
24
- __version__ = "0.1.0.dev250618"
24
+ __version__ = "0.1.0.dev250619"
25
25
 
26
26
  MINIMUM_SUPPORTED_VERSION = "2.5.0"
27
27
  SECURE_TORCH_VERSION = "2.6.0"
@@ -0,0 +1,60 @@
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 LeakyReluArgs
28
+
29
+
30
+ @register_node_visitor
31
+ class LeakyReluVisitor(NodeVisitor):
32
+ target: List[torch._ops.OpOverload] = [torch.ops.aten.leaky_relu.default]
33
+
34
+ def __init__(self, op_codes: Dict[OpCode, int], graph: CircleSubgraph):
35
+ super().__init__(op_codes, graph)
36
+
37
+ def define_node(
38
+ self,
39
+ node: torch.fx.Node,
40
+ ) -> circle.Operator.OperatorT:
41
+ op_index = get_op_index(
42
+ circle.BuiltinOperator.BuiltinOperator.LEAKY_RELU, self._op_codes
43
+ )
44
+
45
+ args = LeakyReluArgs(*node.args, **node.kwargs) # type: ignore[arg-type]
46
+ input = args.input
47
+ negative_slope = args.negative_slope
48
+
49
+ inputs = [input]
50
+ outputs = [node]
51
+
52
+ operator = create_builtin_operator(self.graph, op_index, inputs, outputs)
53
+ operator.builtinOptionsType = (
54
+ circle.BuiltinOptions.BuiltinOptions.LeakyReluOptions
55
+ )
56
+ option = circle.LeakyReluOptions.LeakyReluOptionsT()
57
+ option.alpha = negative_slope
58
+ operator.builtinOptions = option
59
+
60
+ return operator
@@ -124,7 +124,8 @@ class MaxPool2DWithIndicesVisitor(NodeVisitor):
124
124
  padding_type = PaddingType.SAME
125
125
  else:
126
126
  padding_type = PaddingType.VALID
127
- maxpool_input = define_padding_node()
127
+ if padding[0] != 0 or padding[1] != 0:
128
+ maxpool_input = define_padding_node()
128
129
 
129
130
  inputs = [maxpool_input]
130
131
  outputs = [node]
@@ -513,6 +513,17 @@ class InstanceNormArgs:
513
513
  cudnn_enabled: bool
514
514
 
515
515
 
516
+ @enforce_type
517
+ @dataclass
518
+ class LeakyReluArgs:
519
+ """
520
+ leaky_relu(Tensor self, Scalar negative_slope=0.01) -> Tensor
521
+ """
522
+
523
+ input: torch.fx.Node
524
+ negative_slope: float = 0.01
525
+
526
+
516
527
  @enforce_type
517
528
  @dataclass
518
529
  class LinearArgs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tico
3
- Version: 0.1.0.dev250618
3
+ Version: 0.1.0.dev250619
4
4
  Summary: Convert exported Torch module to circle
5
5
  Home-page: UNKNOWN
6
6
  License: UNKNOWN
@@ -1,4 +1,4 @@
1
- tico/__init__.py,sha256=RrIXtcajfToey4BPf7DPtQpe9D5Ds438M8cEHimbNC8,1743
1
+ tico/__init__.py,sha256=tvZ8ebod0VB1gCI6Pf4kkiUWrmA31DGVE_9E2MAjYXo,1743
2
2
  tico/pt2_to_circle.py,sha256=PPmFNw20jw2Z2VyM3ln9pX__jTzBOAZiv0gT5a-p-Y8,2666
3
3
  tico/config/__init__.py,sha256=xZzCXjZ84qE-CsBi-dfaL05bqpQ3stKKfTXhnrJRyVs,142
4
4
  tico/config/base.py,sha256=anwOiJFkUxUi7Cef573JgQcjk6S-FSi6O_TLjYASW-g,1244
@@ -135,6 +135,7 @@ tico/serialize/operators/op_gt.py,sha256=JAVbtuAUNLYhtJycJJCEkYo9QAvmiK4lTMdw5yH
135
135
  tico/serialize/operators/op_index.py,sha256=iDW2YSeUS_kLiWEaQ_MjrYpxZAFBbm7_GU_2B4SRe6c,3033
136
136
  tico/serialize/operators/op_index_select.py,sha256=cw7IbvixooikGxzbpUmI9tHS4kjl4lXLtO9D-GO8qLQ,2277
137
137
  tico/serialize/operators/op_instance_norm.py,sha256=AhcVm71ChB16BlPNwqBh5tMHCqMShOXHPkE8Ag9jBfQ,3144
138
+ tico/serialize/operators/op_leaky_relu.py,sha256=UJPoL7kAIp6nAjyDdda_afdOcMLHme7NE77b2y76exc,2160
138
139
  tico/serialize/operators/op_linear.py,sha256=bw_mn2CiJy8CbpPevOV0PMPh0ZMWKAybLZ9cnIKJSsk,2527
139
140
  tico/serialize/operators/op_log.py,sha256=1TKvH2lttdAHE0P84vcxmOvGBBRUs6D71Jrei7SdZHE,1827
140
141
  tico/serialize/operators/op_log1p.py,sha256=gG7Fs4UDj_Nnp7U60UtPyz0fLv1lBpJVOGGCMm-42pY,3121
@@ -142,7 +143,7 @@ tico/serialize/operators/op_logical_and.py,sha256=WhQ8knuq32BO-WhAqkOgpcUStPkjoP
142
143
  tico/serialize/operators/op_logical_not.py,sha256=ugrVcRqR3IvUUaiRVW5cArCYJbzmkcXp88QM846jCww,2129
143
144
  tico/serialize/operators/op_lt.py,sha256=_vA7dWpV9wVBxB7JL9pLQT9BsV91NGQBq_0auAtHK5Y,2080
144
145
  tico/serialize/operators/op_max_dim.py,sha256=nS_TZl5uq4uv1LwgBD9Wddyac4atKqBiIWKIyeXse2s,2519
145
- tico/serialize/operators/op_max_pool2d_with_indices.py,sha256=SPXIdlrYgJfR982il_ajokNehFYJWOmccUoksS_0qos,5665
146
+ tico/serialize/operators/op_max_pool2d_with_indices.py,sha256=Gd16ebLyo1x_gSXCvq-cBJEQ9jLTRLTd2zBXO7p3DvY,5724
146
147
  tico/serialize/operators/op_maximum.py,sha256=JjBr6gWEnuakLuk1_feotTHfIIm3s5YqWmqhUMpSPI0,1873
147
148
  tico/serialize/operators/op_mean.py,sha256=rVQZOxCJkHFY4kQBAS1HVK0HkcqxgkSy6zvEDLX_WYQ,2267
148
149
  tico/serialize/operators/op_minimum.py,sha256=fASjQVcTPCin02umQwFPdq2ss-Ve7S5A33J3QmmQ_wQ,1873
@@ -192,14 +193,14 @@ tico/utils/register_custom_op.py,sha256=iRQvdqlBqrJxq_pNkvJyDIJD_SYtCUl88wwbbuvS
192
193
  tico/utils/serialize.py,sha256=AQXMBOLu-Kg2Rn-qbqsAtHndjZAZIavlKA0QFgJREHM,1420
193
194
  tico/utils/trace_decorators.py,sha256=ddLIiKQfSaQrxgF1kNpwjFTQnXENzeSfcr1kuAW4jGI,3221
194
195
  tico/utils/utils.py,sha256=fnbZ2RLH6-J-wqb32O4qsR1ce4BJU0wYNrk84QXa6_E,13158
195
- tico/utils/validate_args_kwargs.py,sha256=ZX820o05hmzg3QmmduAy-rIOrDyPHYe6Uj6Yf6Hoe_c,25055
196
+ tico/utils/validate_args_kwargs.py,sha256=vp1GaGhOWqQBD4axMPaULy0tWxoIDTwEqEYoR5S7ph0,25244
196
197
  tico/utils/mx/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
197
198
  tico/utils/mx/elemwise_ops.py,sha256=V6glyAHsVR1joqpsgnNytatCD_ew92xNWZ19UFDoMTA,10281
198
199
  tico/utils/mx/formats.py,sha256=uzNWyu-1onUlwQfX5cZ6fZSUfHMRqorper7_T1k3jfk,3404
199
200
  tico/utils/mx/mx_ops.py,sha256=RcfUTYVi-wilGB2sC35OeARdwDqnixv7dG5iyZ-fQT8,8555
200
- tico-0.1.0.dev250618.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
201
- tico-0.1.0.dev250618.dist-info/METADATA,sha256=3mRIOovwnOiIsT7YPmmjWd_UPnZYKk08Kz-rvj5E7gE,8846
202
- tico-0.1.0.dev250618.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
203
- tico-0.1.0.dev250618.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
204
- tico-0.1.0.dev250618.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
205
- tico-0.1.0.dev250618.dist-info/RECORD,,
201
+ tico-0.1.0.dev250619.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
202
+ tico-0.1.0.dev250619.dist-info/METADATA,sha256=Ms7oDZDD9txOcAycr9TUsJIGoC_B5FmXyF-q2AfJu58,8846
203
+ tico-0.1.0.dev250619.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
204
+ tico-0.1.0.dev250619.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
205
+ tico-0.1.0.dev250619.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
206
+ tico-0.1.0.dev250619.dist-info/RECORD,,