tico 0.1.0.dev250611__py3-none-any.whl → 0.1.0.dev250616__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/fuse_leading_unsqueeze_reshape.py +2 -2
- tico/passes/remove_redundant_reshape.py +9 -9
- tico/serialize/operators/op_reshape.py +1 -1
- tico/utils/validate_args_kwargs.py +1 -1
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/METADATA +7 -2
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/RECORD +11 -11
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/LICENSE +0 -0
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/WHEEL +0 -0
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/entry_points.txt +0 -0
- {tico-0.1.0.dev250611.dist-info → tico-0.1.0.dev250616.dist-info}/top_level.txt +0 -0
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.
|
24
|
+
__version__ = "0.1.0.dev250616"
|
25
25
|
|
26
26
|
MINIMUM_SUPPORTED_VERSION = "2.5.0"
|
27
27
|
SECURE_TORCH_VERSION = "2.6.0"
|
@@ -58,7 +58,7 @@ class FuseLeadingUnsqueezeReshape(PassBase):
|
|
58
58
|
if not is_target_node(reshape_back, ops.aten.reshape):
|
59
59
|
continue
|
60
60
|
reshape_back_args = ReshapeArgs(*reshape_back.args, **reshape_back.kwargs) # type: ignore[arg-type]
|
61
|
-
permute
|
61
|
+
permute = reshape_back_args.input
|
62
62
|
|
63
63
|
if not is_target_node(permute, ops.aten.permute):
|
64
64
|
continue
|
@@ -70,7 +70,7 @@ class FuseLeadingUnsqueezeReshape(PassBase):
|
|
70
70
|
reshape_front_args = ReshapeArgs(*reshape_front.args, **reshape_front.kwargs) # type: ignore[arg-type]
|
71
71
|
reshape_front_input, reshape_front_size = (
|
72
72
|
reshape_front_args.input,
|
73
|
-
reshape_front_args.
|
73
|
+
reshape_front_args.shape,
|
74
74
|
)
|
75
75
|
|
76
76
|
# ---- condition: only leading unsqueeze ------------------------
|
@@ -75,7 +75,7 @@ class RemoveRedundantReshapePattern1(PassBase):
|
|
75
75
|
if len(reshape1.users) != 1:
|
76
76
|
continue
|
77
77
|
reshape1_args = ReshapeArgs(*reshape1.args, **reshape1.kwargs) # type: ignore[arg-type]
|
78
|
-
reshape1_input
|
78
|
+
reshape1_input = reshape1_args.input
|
79
79
|
# `(AxBxC) - aten.reshape` - (1xAxBxC)
|
80
80
|
if [1] + list(extract_shape(reshape1_input)) != list(
|
81
81
|
extract_shape(reshape1)
|
@@ -108,7 +108,7 @@ class RemoveRedundantReshapePattern1(PassBase):
|
|
108
108
|
if len(reshape2.users) != 1:
|
109
109
|
continue
|
110
110
|
reshape2_args = ReshapeArgs(*reshape2.args, **reshape2.kwargs) # type: ignore[arg-type]
|
111
|
-
reshape2_input
|
111
|
+
reshape2_input = reshape2_args.input
|
112
112
|
# (1xAxCxB) - `aten.reshape - (AxCxB)
|
113
113
|
if list(extract_shape(reshape2_input)) != [1] + list(
|
114
114
|
extract_shape(reshape2)
|
@@ -157,7 +157,7 @@ class RemoveRedundantReshapePattern2(PassBase):
|
|
157
157
|
if len(reshape1.users) != 1:
|
158
158
|
continue
|
159
159
|
reshape1_args = ReshapeArgs(*reshape1.args, **reshape1.kwargs) # type: ignore[arg-type]
|
160
|
-
reshape1_input
|
160
|
+
reshape1_input = reshape1_args.input
|
161
161
|
# `(AxBxC) - aten.reshape` - (1xAxBxC)
|
162
162
|
if [1] + list(extract_shape(reshape1_input)) != list(
|
163
163
|
extract_shape(reshape1)
|
@@ -183,7 +183,7 @@ class RemoveRedundantReshapePattern2(PassBase):
|
|
183
183
|
if len(reshape2.users) != 1:
|
184
184
|
continue
|
185
185
|
reshape2_args = ReshapeArgs(*reshape2.args, **reshape2.kwargs) # type: ignore[arg-type]
|
186
|
-
reshape2_input, reshape2_size = reshape2_args.input, reshape2_args.
|
186
|
+
reshape2_input, reshape2_size = reshape2_args.input, reshape2_args.shape
|
187
187
|
# (Bx1xAxC) - `aten.reshape - (Bx(A*C))
|
188
188
|
reshape2_input_shape = list(extract_shape(reshape2_input))
|
189
189
|
assert len(reshape2_input_shape) == 4
|
@@ -270,7 +270,7 @@ class RemoveRedundantReshapePattern3(PassBase):
|
|
270
270
|
if not reshape_2.target in ops.aten.reshape:
|
271
271
|
continue
|
272
272
|
reshape_2_args = ReshapeArgs(*reshape_2.args, **reshape_2.kwargs) # type: ignore[arg-type]
|
273
|
-
reshape_2_input
|
273
|
+
reshape_2_input = reshape_2_args.input
|
274
274
|
assert isinstance(reshape_2_input, torch.fx.Node), type(reshape_2_input)
|
275
275
|
# reshape_3
|
276
276
|
if not reshape_3.op == "call_function":
|
@@ -278,7 +278,7 @@ class RemoveRedundantReshapePattern3(PassBase):
|
|
278
278
|
if not reshape_3.target in ops.aten.reshape:
|
279
279
|
continue
|
280
280
|
reshape_3_args = ReshapeArgs(*reshape_3.args, **reshape_3.kwargs) # type: ignore[arg-type]
|
281
|
-
reshape_3_input
|
281
|
+
reshape_3_input = reshape_3_args.input
|
282
282
|
assert isinstance(reshape_3_input, torch.fx.Node), type(reshape_3_input)
|
283
283
|
|
284
284
|
# Check condition
|
@@ -347,7 +347,7 @@ class RemoveRedundantReshapePattern4(PassBase):
|
|
347
347
|
continue
|
348
348
|
|
349
349
|
reshape1_args = ReshapeArgs(*reshape1.args, **reshape1.kwargs) # type: ignore[arg-type]
|
350
|
-
reshape1_input, size = reshape1_args.input, reshape1_args.
|
350
|
+
reshape1_input, size = reshape1_args.input, reshape1_args.shape
|
351
351
|
assert isinstance(reshape1_input, torch.fx.Node), type(reshape1_input)
|
352
352
|
assert isinstance(size, list), type(size)
|
353
353
|
for s in size:
|
@@ -362,7 +362,7 @@ class RemoveRedundantReshapePattern4(PassBase):
|
|
362
362
|
continue
|
363
363
|
|
364
364
|
reshape2_args = ReshapeArgs(*reshape2.args, **reshape2.kwargs) # type: ignore[arg-type]
|
365
|
-
reshape2_input, reshape2_size = reshape2_args.input, reshape2_args.
|
365
|
+
reshape2_input, reshape2_size = reshape2_args.input, reshape2_args.shape
|
366
366
|
assert isinstance(reshape2_input, torch.fx.Node), type(reshape2_input)
|
367
367
|
assert isinstance(reshape2_size, list), type(reshape2_size)
|
368
368
|
for s in reshape2_size:
|
@@ -410,7 +410,7 @@ class RemoveRedundantReshapePattern5(PassBase):
|
|
410
410
|
continue
|
411
411
|
|
412
412
|
args = ReshapeArgs(*node.args, **node.kwargs) # type: ignore[arg-type]
|
413
|
-
output_shape = args.
|
413
|
+
output_shape = args.shape
|
414
414
|
input_shape = list(extract_shape(args.input))
|
415
415
|
|
416
416
|
if output_shape != input_shape:
|
@@ -48,7 +48,7 @@ class ReshapeVisitor(NodeVisitor):
|
|
48
48
|
)
|
49
49
|
args = ReshapeArgs(*node.args, **node.kwargs) # type: ignore[arg-type]
|
50
50
|
input = args.input
|
51
|
-
size = args.
|
51
|
+
size = args.shape
|
52
52
|
|
53
53
|
if isinstance(size, int):
|
54
54
|
raise NotYetSupportedError("scalar size conversion is not supported yet.")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tico
|
3
|
-
Version: 0.1.0.
|
3
|
+
Version: 0.1.0.dev250616
|
4
4
|
Summary: Convert exported Torch module to circle
|
5
5
|
Home-page: UNKNOWN
|
6
6
|
License: UNKNOWN
|
@@ -105,10 +105,15 @@ You can convert a torch module to a circle model with these steps.
|
|
105
105
|
torch_module = AddModule()
|
106
106
|
example_inputs = (torch.ones(4), torch.ones(4))
|
107
107
|
|
108
|
-
circle_model = tico.convert(torch_module, example_inputs)
|
108
|
+
circle_model = tico.convert(torch_module.eval(), example_inputs)
|
109
109
|
circle_model.save('add.circle')
|
110
110
|
```
|
111
111
|
|
112
|
+
**NOTE**
|
113
|
+
Please make sure to call `eval()` on the PyTorch module before passing it to our API.
|
114
|
+
This ensures the model runs in inference mode, disabling layers like dropout and
|
115
|
+
batch normalization updates.
|
116
|
+
|
112
117
|
**Compile with configuration**
|
113
118
|
|
114
119
|
```python
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tico/__init__.py,sha256=
|
1
|
+
tico/__init__.py,sha256=C7LzUiiXkYNLAtSEQwbhwUac4-sXXzDB7nzZccomIWo,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
|
@@ -75,7 +75,7 @@ tico/passes/decompose_grouped_conv2d.py,sha256=hPRK9D9RDjmJ3mv0Wx17zeNW4xXT2jTQD
|
|
75
75
|
tico/passes/decompose_slice_scatter.py,sha256=mnfEt58PAelJdheD0cJ5C66w_3yqSngCsfM-Auy9ADU,5563
|
76
76
|
tico/passes/extract_dtype_kwargs.py,sha256=ObpsaFlrTPYQw2hJ7UsC5CocyAtBkT_bMtzkMUqAyKc,4333
|
77
77
|
tico/passes/fill_meta_val.py,sha256=Xbam6Aq90ZfWItZw1dgLIwH_q8RCiU5JodKNqkj-ink,1797
|
78
|
-
tico/passes/fuse_leading_unsqueeze_reshape.py,sha256=
|
78
|
+
tico/passes/fuse_leading_unsqueeze_reshape.py,sha256=Y5732qd0MilMQsnPiw--lxTy2lywomKVNoFt2212lLQ,4150
|
79
79
|
tico/passes/fuse_redundant_reshape_to_mean.py,sha256=2SEZ0TfXsmUkuqUdNtS_mQzLd49su5TsQViCLMGL4f4,3691
|
80
80
|
tico/passes/legalize_causal_mask_value.py,sha256=xKdFwwMaSFCSQpSk8xISOAqFpZ1jIhgbBIqf7KTSGuk,4017
|
81
81
|
tico/passes/legalize_predefined_layout_operators.py,sha256=4AAqYvwMvtuAQ8mdpTJI6oIgcBL_iSMzB0pmcvJ6i3Y,15887
|
@@ -88,7 +88,7 @@ tico/passes/remove_nop.py,sha256=Hf91p_EJAOC6DyWNthash0_UWtEcNc_M7znamQfYQ5Y,268
|
|
88
88
|
tico/passes/remove_redundant_assert_nodes.py,sha256=IONd3xBy6I8tH6_Y1eN3_eCHH7WTC8soBgjXzOju9cQ,1612
|
89
89
|
tico/passes/remove_redundant_expand.py,sha256=5SIqN7eIIcqF68tlrB31n1482jSBSBOgKb1wddLX6lw,2197
|
90
90
|
tico/passes/remove_redundant_permute.py,sha256=ovrEpB9x_Pjdfq6N35cDyURjP8ZBlAqgFiitPxTvUlI,4204
|
91
|
-
tico/passes/remove_redundant_reshape.py,sha256=
|
91
|
+
tico/passes/remove_redundant_reshape.py,sha256=MMd9NWf9iTNIWqizFjC7ykA-JipmMMLCfkrGinSsfno,16227
|
92
92
|
tico/passes/remove_redundant_slice.py,sha256=Iv7TbB39fktNb4eq0VdyZnwxL_VsKLJ90diMmaf3kZk,2087
|
93
93
|
tico/passes/remove_redundant_to_copy.py,sha256=JMDnca2f9OE58ejdMEoZ1O0l-rGAc5T91BT-dFk7FGk,3114
|
94
94
|
tico/passes/restore_linear.py,sha256=UMMHdLmRGq9bfJx_0L9lL2UQBd51PGNP0WywO8KdrDM,4066
|
@@ -157,7 +157,7 @@ tico/serialize/operators/op_reciprocal.py,sha256=6b9_bxjg_0EvgAitSv1MgBi4PJSEgm-
|
|
157
157
|
tico/serialize/operators/op_relu.py,sha256=WXCR_chwEUBqjFIQ_4E2avwk-Acy76pmX20rJQCBTQo,1832
|
158
158
|
tico/serialize/operators/op_relu6.py,sha256=ZWqEolfAKjOdUC1ZCg0iuu4dBhkJRxVYR2tUzpbvKQM,1829
|
159
159
|
tico/serialize/operators/op_repeat.py,sha256=0wTv1Mg7kg0eHz0CT6atyVAli4T4h5rYXq5opY6op20,4235
|
160
|
-
tico/serialize/operators/op_reshape.py,sha256=
|
160
|
+
tico/serialize/operators/op_reshape.py,sha256=0_bJwimiGAHaKkfwfhxUw9Gebt5tnecGaEVoKhEvV0Q,2550
|
161
161
|
tico/serialize/operators/op_resize_nearest_neighbor.py,sha256=dXaAnZ5M_ko_tH-HolxNpHFXkDUQ8x45myskojP5XZE,2771
|
162
162
|
tico/serialize/operators/op_rsqrt.py,sha256=yl2vd8InjhLPbE0vHIrEera6DVXlY9dLgO7yZZCH3RI,1837
|
163
163
|
tico/serialize/operators/op_scalar_tensor.py,sha256=vDWxi4hXwyDJJhvfMR_QrBInw_No3WeU_M4gtfZqmbo,1928
|
@@ -191,14 +191,14 @@ tico/utils/register_custom_op.py,sha256=iRQvdqlBqrJxq_pNkvJyDIJD_SYtCUl88wwbbuvS
|
|
191
191
|
tico/utils/serialize.py,sha256=AQXMBOLu-Kg2Rn-qbqsAtHndjZAZIavlKA0QFgJREHM,1420
|
192
192
|
tico/utils/trace_decorators.py,sha256=ddLIiKQfSaQrxgF1kNpwjFTQnXENzeSfcr1kuAW4jGI,3221
|
193
193
|
tico/utils/utils.py,sha256=fnbZ2RLH6-J-wqb32O4qsR1ce4BJU0wYNrk84QXa6_E,13158
|
194
|
-
tico/utils/validate_args_kwargs.py,sha256=
|
194
|
+
tico/utils/validate_args_kwargs.py,sha256=ZX820o05hmzg3QmmduAy-rIOrDyPHYe6Uj6Yf6Hoe_c,25055
|
195
195
|
tico/utils/mx/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
196
196
|
tico/utils/mx/elemwise_ops.py,sha256=V6glyAHsVR1joqpsgnNytatCD_ew92xNWZ19UFDoMTA,10281
|
197
197
|
tico/utils/mx/formats.py,sha256=uzNWyu-1onUlwQfX5cZ6fZSUfHMRqorper7_T1k3jfk,3404
|
198
198
|
tico/utils/mx/mx_ops.py,sha256=RcfUTYVi-wilGB2sC35OeARdwDqnixv7dG5iyZ-fQT8,8555
|
199
|
-
tico-0.1.0.
|
200
|
-
tico-0.1.0.
|
201
|
-
tico-0.1.0.
|
202
|
-
tico-0.1.0.
|
203
|
-
tico-0.1.0.
|
204
|
-
tico-0.1.0.
|
199
|
+
tico-0.1.0.dev250616.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
|
200
|
+
tico-0.1.0.dev250616.dist-info/METADATA,sha256=gEVJ9bVRXMqIw5UOqPGS-j3CV7dkmpuFC35cZxg3sBk,8846
|
201
|
+
tico-0.1.0.dev250616.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
202
|
+
tico-0.1.0.dev250616.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
|
203
|
+
tico-0.1.0.dev250616.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
|
204
|
+
tico-0.1.0.dev250616.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|