tico 0.1.0.dev250519__py3-none-any.whl → 0.1.0.dev250520__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/experimental/quantization/passes/remove_weight_dequant_op.py +10 -4
- tico/passes/decompose_fake_quantize_tensor_qparams.py +14 -0
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/METADATA +1 -1
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/RECORD +9 -9
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/LICENSE +0 -0
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/WHEEL +0 -0
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/entry_points.txt +0 -0
- {tico-0.1.0.dev250519.dist-info → tico-0.1.0.dev250520.dist-info}/top_level.txt +0 -0
tico/__init__.py
CHANGED
@@ -22,7 +22,7 @@ from tico.config import CompileConfigV1, get_default_config
|
|
22
22
|
from tico.utils.convert import convert, convert_from_exported_program, convert_from_pt2
|
23
23
|
|
24
24
|
# THIS LINE IS AUTOMATICALLY GENERATED BY setup.py
|
25
|
-
__version__ = "0.1.0.
|
25
|
+
__version__ = "0.1.0.dev250520"
|
26
26
|
|
27
27
|
|
28
28
|
if Version(torch.__version__) < Version("2.5.0"):
|
@@ -17,6 +17,12 @@ from typing import List, Optional, TYPE_CHECKING, Union
|
|
17
17
|
if TYPE_CHECKING:
|
18
18
|
import torch.fx
|
19
19
|
import torch
|
20
|
+
from torch._export.utils import (
|
21
|
+
get_buffer,
|
22
|
+
get_lifted_tensor_constant,
|
23
|
+
is_buffer,
|
24
|
+
is_lifted_tensor_constant,
|
25
|
+
)
|
20
26
|
from torch._subclasses.fake_tensor import FakeTensor
|
21
27
|
from torch.export import ExportedProgram
|
22
28
|
|
@@ -34,10 +40,10 @@ def get_constant(exported_program: ExportedProgram, node: torch.fx.Node):
|
|
34
40
|
assert isinstance(node, torch.fx.Node)
|
35
41
|
if node.name in exported_program.constants:
|
36
42
|
return exported_program.constants[node.name]
|
37
|
-
elif node
|
38
|
-
|
39
|
-
|
40
|
-
return
|
43
|
+
elif is_buffer(exported_program, node):
|
44
|
+
return get_buffer(exported_program, node)
|
45
|
+
elif is_lifted_tensor_constant(exported_program, node):
|
46
|
+
return get_lifted_tensor_constant(exported_program, node)
|
41
47
|
else:
|
42
48
|
raise RuntimeError("NYI constant")
|
43
49
|
|
@@ -18,6 +18,12 @@ if TYPE_CHECKING:
|
|
18
18
|
import torch._ops
|
19
19
|
import torch.fx
|
20
20
|
import torch
|
21
|
+
from torch._export.utils import (
|
22
|
+
get_buffer,
|
23
|
+
get_lifted_tensor_constant,
|
24
|
+
is_buffer,
|
25
|
+
is_lifted_tensor_constant,
|
26
|
+
)
|
21
27
|
|
22
28
|
# To import torch.ops.quantized_decomposed related operator
|
23
29
|
from torch.ao.quantization.fx._decomposed import quantized_decomposed_lib
|
@@ -55,6 +61,14 @@ def get_constant_from_tensor(
|
|
55
61
|
"""
|
56
62
|
if isinstance(node, float):
|
57
63
|
return node
|
64
|
+
if is_buffer(ep, node):
|
65
|
+
buf = get_buffer(ep, node)
|
66
|
+
assert isinstance(buf, torch.Tensor)
|
67
|
+
return buf.item()
|
68
|
+
elif is_lifted_tensor_constant(ep, node):
|
69
|
+
lifted = get_lifted_tensor_constant(ep, node)
|
70
|
+
assert isinstance(lifted, torch.Tensor)
|
71
|
+
return lifted.item()
|
58
72
|
assert isinstance(node.target, torch._ops.OpOverload)
|
59
73
|
if node.target.__name__ == "mul.Tensor":
|
60
74
|
assert len(node.args) == 2
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tico/__init__.py,sha256=
|
1
|
+
tico/__init__.py,sha256=80nv6fiJM89LQkz5EODIec-qHWe6hHtEOZ5u7L1wYnY,1181
|
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
|
@@ -54,7 +54,7 @@ tico/experimental/quantization/passes/fold_quant_ops.py,sha256=Jq5wmQDhdjsXxae2p
|
|
54
54
|
tico/experimental/quantization/passes/insert_quantize_on_dtype_mismatch.py,sha256=i4rkM1vlN85fXA9oOrU25o8KWAaqA65NKngTX6MgctQ,12960
|
55
55
|
tico/experimental/quantization/passes/propagate_qparam_backward.py,sha256=TGtyW0Z2qOTgVIasBdGRgbwH31YYd6ek7OvLTmCV614,3118
|
56
56
|
tico/experimental/quantization/passes/propagate_qparam_forward.py,sha256=RhUHGCR2RpBO5KYkQ7Z8U5u7HEwDq2wdKHLKAJCi-5c,5138
|
57
|
-
tico/experimental/quantization/passes/remove_weight_dequant_op.py,sha256=
|
57
|
+
tico/experimental/quantization/passes/remove_weight_dequant_op.py,sha256=lNemHkr_IMg6kTIQjk4xLgW4DkDNBr0wTW3miNqmvkc,6450
|
58
58
|
tico/interpreter/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
59
59
|
tico/interpreter/infer.py,sha256=vJ3b69ce9HrxNT0gFwbEhHpAyvVyuiunTgAeiqn5t64,4350
|
60
60
|
tico/interpreter/interpreter.py,sha256=tGbluCbrehTCqBu8mtGDNzby_ieJ2ry8_RH_eC0CQxk,3828
|
@@ -69,7 +69,7 @@ tico/passes/convert_to_relu6.py,sha256=3sfKfggvjbl9N73pLOwgUTNyoecODsy367nwoX2S-
|
|
69
69
|
tico/passes/decompose_addmm.py,sha256=_yNX7wx1Y9HJI5ksUJI-UQLHpoNawbUbF8kcm2zGHw0,4221
|
70
70
|
tico/passes/decompose_batch_norm.py,sha256=d1V9UOkm_5BV0NGLyuQfz4I9NpO7I3ZrRugt7EXM-XM,7016
|
71
71
|
tico/passes/decompose_fake_quantize.py,sha256=7ZJyTIDj2iKgWa5q8mBSq6k0GX0vs_XyQdsIiWFJoTU,5175
|
72
|
-
tico/passes/decompose_fake_quantize_tensor_qparams.py,sha256=
|
72
|
+
tico/passes/decompose_fake_quantize_tensor_qparams.py,sha256=kOQaODKl_GCE19h-UZGmxnTcHtlvphI63dVAmMQL_Bk,13823
|
73
73
|
tico/passes/decompose_group_norm.py,sha256=UVEzOBi4aUr3IlP6iWlYlo4u-8cmJ4JvKl8r2-qGBj4,9670
|
74
74
|
tico/passes/decompose_grouped_conv2d.py,sha256=KJhH6PX7l9k9T8KBV8JDAvaSfJuUnRo_jtvGF2aM-LA,8277
|
75
75
|
tico/passes/decompose_slice_scatter.py,sha256=ko9p8v-zY5rOx4aSpWomwSdSWb1lIF32gnU7ik5xgII,5604
|
@@ -192,9 +192,9 @@ tico/utils/mx/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
192
192
|
tico/utils/mx/elemwise_ops.py,sha256=V6glyAHsVR1joqpsgnNytatCD_ew92xNWZ19UFDoMTA,10281
|
193
193
|
tico/utils/mx/formats.py,sha256=uzNWyu-1onUlwQfX5cZ6fZSUfHMRqorper7_T1k3jfk,3404
|
194
194
|
tico/utils/mx/mx_ops.py,sha256=RcfUTYVi-wilGB2sC35OeARdwDqnixv7dG5iyZ-fQT8,8555
|
195
|
-
tico-0.1.0.
|
196
|
-
tico-0.1.0.
|
197
|
-
tico-0.1.0.
|
198
|
-
tico-0.1.0.
|
199
|
-
tico-0.1.0.
|
200
|
-
tico-0.1.0.
|
195
|
+
tico-0.1.0.dev250520.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
|
196
|
+
tico-0.1.0.dev250520.dist-info/METADATA,sha256=E3Tizp7XTBYhstti5Qh5Q5HYd-7XiVA6zfwUD8T0DII,8633
|
197
|
+
tico-0.1.0.dev250520.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
198
|
+
tico-0.1.0.dev250520.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
|
199
|
+
tico-0.1.0.dev250520.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
|
200
|
+
tico-0.1.0.dev250520.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|