mct-nightly 1.1.0.7012022.post2611__py3-none-any.whl → 1.1.0.07122021-002414__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.
- {mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/METADATA +3 -3
- {mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/RECORD +72 -76
- {mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/WHEEL +1 -1
- model_compression_toolkit/common/__init__.py +2 -2
- model_compression_toolkit/common/bias_correction/apply_bias_correction_to_graph.py +2 -2
- model_compression_toolkit/common/bias_correction/compute_bias_correction_of_graph.py +9 -9
- model_compression_toolkit/common/collectors/mean_collector.py +2 -3
- model_compression_toolkit/common/collectors/min_max_per_channel_collector.py +3 -6
- model_compression_toolkit/common/constants.py +0 -1
- model_compression_toolkit/common/framework_implementation.py +6 -22
- model_compression_toolkit/common/framework_info.py +7 -39
- model_compression_toolkit/common/graph/__init__.py +1 -1
- model_compression_toolkit/common/graph/base_graph.py +34 -34
- model_compression_toolkit/common/graph/edge.py +3 -3
- model_compression_toolkit/common/graph/graph_matchers.py +3 -3
- model_compression_toolkit/common/graph/graph_searches.py +4 -4
- model_compression_toolkit/common/graph/graph_vis.py +116 -0
- model_compression_toolkit/common/graph/{base_node.py → node.py} +27 -11
- model_compression_toolkit/common/mixed_precision/bit_width_setter.py +9 -10
- model_compression_toolkit/common/mixed_precision/mixed_precision_search_manager.py +1 -1
- model_compression_toolkit/common/model_collector.py +12 -14
- model_compression_toolkit/common/network_editors/actions.py +23 -19
- model_compression_toolkit/common/post_training_quantization.py +7 -20
- model_compression_toolkit/common/quantization/node_quantization_config.py +5 -13
- model_compression_toolkit/common/quantization/quantization_analyzer.py +7 -11
- model_compression_toolkit/common/quantization/quantization_config.py +6 -6
- model_compression_toolkit/common/quantization/quantization_params_fn_selection.py +3 -2
- model_compression_toolkit/common/quantization/quantization_params_generation/qparams_activations_computation.py +7 -13
- model_compression_toolkit/common/quantization/quantization_params_generation/qparams_computation.py +20 -17
- model_compression_toolkit/common/quantization/quantize_node.py +2 -2
- model_compression_toolkit/common/quantization/set_node_quantization_config.py +36 -39
- model_compression_toolkit/common/{collectors/statistics_collector.py → statistics_collector.py} +30 -26
- model_compression_toolkit/common/visualization/tensorboard_writer.py +8 -11
- model_compression_toolkit/keras/back2framework/instance_builder.py +4 -4
- model_compression_toolkit/keras/back2framework/model_builder.py +34 -47
- model_compression_toolkit/keras/constants.py +0 -3
- model_compression_toolkit/keras/default_framework_info.py +7 -33
- model_compression_toolkit/keras/gradient_ptq/graph_info.py +2 -2
- model_compression_toolkit/keras/gradient_ptq/graph_update.py +1 -7
- model_compression_toolkit/keras/gradient_ptq/training_wrapper.py +1 -0
- model_compression_toolkit/keras/graph_substitutions/substitutions/activation_decomposition.py +8 -10
- model_compression_toolkit/keras/graph_substitutions/substitutions/batchnorm_folding.py +2 -2
- model_compression_toolkit/keras/graph_substitutions/substitutions/input_scaling.py +2 -2
- model_compression_toolkit/keras/graph_substitutions/substitutions/mark_activation.py +3 -3
- model_compression_toolkit/keras/graph_substitutions/substitutions/relu_bound_correction.py +4 -3
- model_compression_toolkit/keras/graph_substitutions/substitutions/remove_relu_upper_bound.py +2 -2
- model_compression_toolkit/keras/graph_substitutions/substitutions/scale_equalization.py +9 -9
- model_compression_toolkit/keras/graph_substitutions/substitutions/separableconv_decomposition.py +19 -19
- model_compression_toolkit/keras/graph_substitutions/substitutions/shift_negative_activation.py +45 -64
- model_compression_toolkit/keras/keras_implementation.py +8 -28
- model_compression_toolkit/keras/mixed_precision/sensitivity_evaluation.py +2 -2
- model_compression_toolkit/keras/quantization_facade.py +1 -5
- model_compression_toolkit/keras/quantizer/fake_quant_builder.py +4 -4
- model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer.py +2 -3
- model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer_gptq_config.py +4 -8
- model_compression_toolkit/keras/quantizer/gradient_ptq/activation_weight_quantizer_gptq_config.py +4 -9
- model_compression_toolkit/keras/quantizer/gradient_ptq/config_factory.py +10 -9
- model_compression_toolkit/keras/quantizer/gradient_ptq/weight_quantizer_gptq_config.py +1 -9
- model_compression_toolkit/keras/quantizer/mixed_precision/quantization_config_factory.py +1 -1
- model_compression_toolkit/keras/quantizer/mixed_precision/selective_weights_quantize_config.py +1 -6
- model_compression_toolkit/keras/reader/common.py +11 -9
- model_compression_toolkit/keras/reader/connectivity_handler.py +9 -15
- model_compression_toolkit/keras/reader/nested_model/edges_merger.py +6 -6
- model_compression_toolkit/keras/reader/nested_model/nested_model_handler.py +2 -2
- model_compression_toolkit/keras/reader/nested_model/nodes_merger.py +3 -3
- model_compression_toolkit/keras/reader/nested_model/outputs_merger.py +2 -2
- model_compression_toolkit/keras/reader/node_builder.py +15 -65
- model_compression_toolkit/keras/reader/reader.py +5 -5
- model_compression_toolkit/keras/tensor_marking.py +113 -0
- model_compression_toolkit/keras/visualization/nn_visualizer.py +2 -2
- model_compression_toolkit/common/collectors/statistics_collector_generator.py +0 -43
- model_compression_toolkit/common/graph/functional_node.py +0 -59
- model_compression_toolkit/common/model_validation.py +0 -43
- model_compression_toolkit/common/node_prior_info.py +0 -29
- model_compression_toolkit/keras/keras_model_validation.py +0 -38
- model_compression_toolkit/keras/keras_node_prior_info.py +0 -60
- {mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/LICENSE +0 -0
- {mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mct-nightly
|
|
3
|
-
Version: 1.1.0.
|
|
3
|
+
Version: 1.1.0.07122021-002414
|
|
4
4
|
Summary: A Model Compression Toolkit for neural networks
|
|
5
5
|
Home-page: UNKNOWN
|
|
6
6
|
License: UNKNOWN
|
|
@@ -23,7 +23,7 @@ Requires-Dist: PuLP
|
|
|
23
23
|
Requires-Dist: matplotlib
|
|
24
24
|
|
|
25
25
|
# Model Compression Toolkit (MCT)
|
|
26
|
-

|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
Model Compression Toolkit (MCT) is an open source project for neural network model optimization under efficient, constrained hardware. <br />
|
|
@@ -124,7 +124,7 @@ Tensorboard Visualization (Experimental):
|
|
|
124
124
|
|
|
125
125
|
Note that currently we only have full support for Keras layers. Using the TensorFlow native layers may lead to unexpected behavior. This limitation will be removed in future releases.
|
|
126
126
|
|
|
127
|
-
MCT is tested with Tensorflow Version 2.
|
|
127
|
+
MCT is tested with Tensorflow Version 2.5.
|
|
128
128
|
|
|
129
129
|
## Tutorials and Results
|
|
130
130
|
As part of the MCT library, we have a set of example networks on image classification. These networks can be used as examples when using the package.
|
{mct_nightly-1.1.0.7012022.post2611.dist-info → mct_nightly-1.1.0.7122021.post2414.dist-info}/RECORD
RENAMED
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
model_compression_toolkit/__init__.py,sha256=67dpO_HEzKkzOdx7tCF8ucJ2vvgwI65cYd7bo46_qbY,1860
|
|
2
|
-
model_compression_toolkit/common/__init__.py,sha256=
|
|
2
|
+
model_compression_toolkit/common/__init__.py,sha256=LtklANR21DvGL9oO4ila5u6Ft7M83-dqftICub6Vowk,1454
|
|
3
3
|
model_compression_toolkit/common/base_substitutions.py,sha256=FHVBXTdn_sh6QpkdOpZ4IObcoeF49klPvak3T1XSHzs,1656
|
|
4
|
-
model_compression_toolkit/common/constants.py,sha256=
|
|
4
|
+
model_compression_toolkit/common/constants.py,sha256=DWcVXmyONazCWZYp6LT-0Kav0bbMxfB8sDWjMRAxqxY,1472
|
|
5
5
|
model_compression_toolkit/common/data_loader.py,sha256=fqTPODRsWZAhkXExE4iP2kgtHv5kOw1UzBojWXIrq7c,4018
|
|
6
6
|
model_compression_toolkit/common/defaultdict.py,sha256=C9LVHx7D0WniqOsoiENkPNdUj49kiQEabESr6FRT5OA,2132
|
|
7
|
-
model_compression_toolkit/common/framework_implementation.py,sha256=
|
|
8
|
-
model_compression_toolkit/common/framework_info.py,sha256=
|
|
7
|
+
model_compression_toolkit/common/framework_implementation.py,sha256=mz3WI7wgXoo_jIs_XM-D1uCl7S-gEPml3UKDjAGri3w,9827
|
|
8
|
+
model_compression_toolkit/common/framework_info.py,sha256=mpPvVS8JYa987MYqmfj32iEsLY-vhqY8UGtgoUYK3_k,7723
|
|
9
9
|
model_compression_toolkit/common/logger.py,sha256=RrDE9VCndUrdbQ_4DL5VP8z10fr5BMCJvxswHIvb3Os,4674
|
|
10
10
|
model_compression_toolkit/common/model_builder_mode.py,sha256=G06Tpf-p7vBpa_k0Z8sNdbwhN_QEX-3lf0ajafSrQKA,1488
|
|
11
|
-
model_compression_toolkit/common/model_collector.py,sha256=
|
|
12
|
-
model_compression_toolkit/common/
|
|
13
|
-
model_compression_toolkit/common/node_prior_info.py,sha256=Vhw4XgJs9h1GPKWxpIocmuMj98TdEhu2GiQMrSkwxPc,793
|
|
14
|
-
model_compression_toolkit/common/post_training_quantization.py,sha256=ZzeYeiF6bcQQMT_X52hQRndwWC5EG9kNc5u7nN-045w,23068
|
|
11
|
+
model_compression_toolkit/common/model_collector.py,sha256=c-wy-ln9o9FI7jgpS4pXEB3h81XLXwXKPrY0qjdHQuw,4665
|
|
12
|
+
model_compression_toolkit/common/post_training_quantization.py,sha256=T6T9YmoKgXZMdRuLKVZVVviXb7SaefnQ4HNsk5AiWv4,22575
|
|
15
13
|
model_compression_toolkit/common/similarity_analyzer.py,sha256=8PhDElbAhWA2v_pWXDL7kxxXr-xQo0RNulo0y9pmI2c,5411
|
|
14
|
+
model_compression_toolkit/common/statistics_collector.py,sha256=cv-qrVM9JY9JLyxfC5G2EzqPAdbOBMN4Gm3Qf9tOhIY,7973
|
|
16
15
|
model_compression_toolkit/common/user_info.py,sha256=OYUdFBma5TKrDLBXEjgo1Oj0RK0zpvkVmP_5ZJ0X-2c,1535
|
|
17
16
|
model_compression_toolkit/common/bias_correction/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
18
|
-
model_compression_toolkit/common/bias_correction/apply_bias_correction_to_graph.py,sha256=
|
|
19
|
-
model_compression_toolkit/common/bias_correction/compute_bias_correction_of_graph.py,sha256=
|
|
17
|
+
model_compression_toolkit/common/bias_correction/apply_bias_correction_to_graph.py,sha256=xYQoZ24IuFrm-4c415BCirYbRaDjKl9OnCW4TDUxO7k,3328
|
|
18
|
+
model_compression_toolkit/common/bias_correction/compute_bias_correction_of_graph.py,sha256=UKpQZzK7U8xc5Tu2ZJIRk2b_rNB8I-lJDDIYWvcfr1A,8372
|
|
20
19
|
model_compression_toolkit/common/collectors/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
21
20
|
model_compression_toolkit/common/collectors/base_collector.py,sha256=s1Kne14LcFUajwftMBrusu0wTPHCUQx4TegPcFSWVss,2427
|
|
22
21
|
model_compression_toolkit/common/collectors/histogram_collector.py,sha256=_MDJPsa98rsuN1p8ix3fhoeCg6k9lEZjBvyqTLQ9Fqw,6860
|
|
23
|
-
model_compression_toolkit/common/collectors/mean_collector.py,sha256=
|
|
24
|
-
model_compression_toolkit/common/collectors/min_max_per_channel_collector.py,sha256=
|
|
25
|
-
model_compression_toolkit/common/collectors/statistics_collector.py,sha256=1iLprwqDiMe8jID2VUn535YsR6bPDwfeAUmwKWQ52AA,7882
|
|
26
|
-
model_compression_toolkit/common/collectors/statistics_collector_generator.py,sha256=02vovEDuGGYtHVN9AlEqccjqCyVQx_Kh39-FCooK4Qw,1857
|
|
22
|
+
model_compression_toolkit/common/collectors/mean_collector.py,sha256=x3n2dmZl2EuXh_LgEQnO7YMlL6G7s0nFltsIhXGx6W0,3835
|
|
23
|
+
model_compression_toolkit/common/collectors/min_max_per_channel_collector.py,sha256=ZzJkogbqDkVj_tiS3gzHfTsEkomroeHBcJrXod0ga4k,5031
|
|
27
24
|
model_compression_toolkit/common/gptq/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
28
25
|
model_compression_toolkit/common/gptq/gptq_config.py,sha256=XDfJgamLEyJKyq4rmhX5gqhM30a1DiJjKqoy3N6t1pM,2787
|
|
29
|
-
model_compression_toolkit/common/graph/__init__.py,sha256=
|
|
30
|
-
model_compression_toolkit/common/graph/base_graph.py,sha256=
|
|
31
|
-
model_compression_toolkit/common/graph/
|
|
32
|
-
model_compression_toolkit/common/graph/
|
|
33
|
-
model_compression_toolkit/common/graph/
|
|
34
|
-
model_compression_toolkit/common/graph/
|
|
35
|
-
model_compression_toolkit/common/graph/
|
|
26
|
+
model_compression_toolkit/common/graph/__init__.py,sha256=3x8iejFh5xa6tUnOtu5tU7KFOKdRqADhNac89pDItWo,760
|
|
27
|
+
model_compression_toolkit/common/graph/base_graph.py,sha256=jUDItUWIDquKTmEtVtQ-WC2gK8l7QPZKN_1LHF-tmhs,18408
|
|
28
|
+
model_compression_toolkit/common/graph/edge.py,sha256=J1ksD-NHXNA_aMqoEQEaR81URLuAht2KNwu_ARwODHE,3712
|
|
29
|
+
model_compression_toolkit/common/graph/graph_matchers.py,sha256=8m51Ve__sQ-joGxNSyQZJImUE5zGgkp2xuSdhWIb1zY,4754
|
|
30
|
+
model_compression_toolkit/common/graph/graph_searches.py,sha256=HYG5f1SN3cKA3Jeq9iUnubk1EJiPD6k-g6ufFTXaIKc,5093
|
|
31
|
+
model_compression_toolkit/common/graph/graph_vis.py,sha256=NqWkLW75ap2n-RX_TmooVtxJ63iR3BgtfRR6f4eUWYs,3704
|
|
32
|
+
model_compression_toolkit/common/graph/node.py,sha256=LUi8l1-mzrI-0_USw1Zt-1j6xkHT4tDSAPx9OXBc5pI,7527
|
|
36
33
|
model_compression_toolkit/common/matchers/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
37
34
|
model_compression_toolkit/common/matchers/base_graph_filter.py,sha256=I7MGK5YMfk9jvUeh_oD3LMgpVg4DLWWKjcVLhXQdQOo,3092
|
|
38
35
|
model_compression_toolkit/common/matchers/base_matcher.py,sha256=qpj-Xfmbd6Vdv46GCWx5w1xrOA8FyOVUlBXLCWVH76A,2151
|
|
@@ -41,26 +38,26 @@ model_compression_toolkit/common/matchers/function.py,sha256=Aqe0gLQJUSAn-unHYF5
|
|
|
41
38
|
model_compression_toolkit/common/matchers/node_matcher.py,sha256=fyKrVaC_S1qU-Fx-SJVW0YxEDv7LMHDUZQyfMgbH-xY,2746
|
|
42
39
|
model_compression_toolkit/common/matchers/walk_matcher.py,sha256=wZuTitcKe4CeGizwb4P1_D5o1wd7ZfaKRA_tTng8FeQ,1112
|
|
43
40
|
model_compression_toolkit/common/mixed_precision/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
44
|
-
model_compression_toolkit/common/mixed_precision/bit_width_setter.py,sha256=
|
|
41
|
+
model_compression_toolkit/common/mixed_precision/bit_width_setter.py,sha256=DpgZatq-gEhUHfuN4xw3iagiMrNih1poWGd3uVDVW8g,6431
|
|
45
42
|
model_compression_toolkit/common/mixed_precision/distance_weighting.py,sha256=-UPf9wXIOKZC4xSs_qvvtPr3_dUoQKk5_Y5LW-btgQY,3591
|
|
46
43
|
model_compression_toolkit/common/mixed_precision/kpi.py,sha256=eUYXmR7LJC2SG77XI2yy29UkS_2uimxcS03EzXZJox4,1279
|
|
47
44
|
model_compression_toolkit/common/mixed_precision/mixed_precision_quantization_config.py,sha256=AdBlSHCK3J9Yr3c2tXkD1iRB70Blcpj0aKm6XKojbVY,3009
|
|
48
45
|
model_compression_toolkit/common/mixed_precision/mixed_precision_search_facade.py,sha256=9sop2XIDqJKP-fpvpiNfHQF8VcgRbQ1OqKsd_3Wt6L0,4713
|
|
49
|
-
model_compression_toolkit/common/mixed_precision/mixed_precision_search_manager.py,sha256=
|
|
46
|
+
model_compression_toolkit/common/mixed_precision/mixed_precision_search_manager.py,sha256=fhew3IF3xZEKTahgVzoZwqJaAsAmHxc5eqhK82tC2VU,5904
|
|
50
47
|
model_compression_toolkit/common/mixed_precision/search_methods/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
51
48
|
model_compression_toolkit/common/mixed_precision/search_methods/linear_programming.py,sha256=-6KfaChr2Ub-ewN9IN7Z16CgniTkoJBhAJdALOiHzJU,13199
|
|
52
49
|
model_compression_toolkit/common/network_editors/__init__.py,sha256=dJWrbHs2NeGYW7Kzy7m7waIw8Ounjd1tiiL0a4nRAos,1235
|
|
53
|
-
model_compression_toolkit/common/network_editors/actions.py,sha256=
|
|
50
|
+
model_compression_toolkit/common/network_editors/actions.py,sha256=czJlYQnC6r38XJcpipvcCy2DQNd01QRwkIh_d3BLwSg,13118
|
|
54
51
|
model_compression_toolkit/common/network_editors/edit_network.py,sha256=KsfILh0y_n5kqkaAJDeuHtJ5Pgf4OW6oWjl13ySV0QQ,1723
|
|
55
52
|
model_compression_toolkit/common/network_editors/node_filters.py,sha256=W10GgyW8JicTgc10VjJtbFTuFVHuoOb8HDwWzxl4qdg,3151
|
|
56
53
|
model_compression_toolkit/common/quantization/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
57
|
-
model_compression_toolkit/common/quantization/node_quantization_config.py,sha256=
|
|
58
|
-
model_compression_toolkit/common/quantization/quantization_analyzer.py,sha256=
|
|
59
|
-
model_compression_toolkit/common/quantization/quantization_config.py,sha256=
|
|
60
|
-
model_compression_toolkit/common/quantization/quantization_params_fn_selection.py,sha256=
|
|
54
|
+
model_compression_toolkit/common/quantization/node_quantization_config.py,sha256=e81Yoqtp6e8saCDZFd2bYJMRtdxQ7aPCorwhYQSws6g,9359
|
|
55
|
+
model_compression_toolkit/common/quantization/quantization_analyzer.py,sha256=xcZ2BPvUZ5ATNStavKjWOcJnvx8OQ7yBG0O_GgcsvuE,2972
|
|
56
|
+
model_compression_toolkit/common/quantization/quantization_config.py,sha256=N2JZFO2AFlAqv9KbKYtIZlfKi2Dsb5RjNCNR8O76DPs,8503
|
|
57
|
+
model_compression_toolkit/common/quantization/quantization_params_fn_selection.py,sha256=WSarcRfTcG2t62JCXIIucbe86oM_856vCb_1ygn-FeM,5448
|
|
61
58
|
model_compression_toolkit/common/quantization/quantize_graph_weights.py,sha256=VopC_NxKd1rWjXhSTigZdnyldEocfsPAyeX-3WtEzkM,2993
|
|
62
|
-
model_compression_toolkit/common/quantization/quantize_node.py,sha256=
|
|
63
|
-
model_compression_toolkit/common/quantization/set_node_quantization_config.py,sha256=
|
|
59
|
+
model_compression_toolkit/common/quantization/quantize_node.py,sha256=MatcsOaUX0ogXzD8WH5v7zUc2ITsHBTpBGw3diYT88w,3593
|
|
60
|
+
model_compression_toolkit/common/quantization/set_node_quantization_config.py,sha256=MNn4o26souwd1rkdxWbXF97TA_12knNEuRiVaj4vlCw,7729
|
|
64
61
|
model_compression_toolkit/common/quantization/quantization_params_generation/__init__.py,sha256=8wFyT6t-uX0MQ-2QCa4qGZYmquhWroEdBrsren6wrlI,2045
|
|
65
62
|
model_compression_toolkit/common/quantization/quantization_params_generation/kl_selection.py,sha256=Rk7yKNZDXePffzcOxlqK1er8mXkw0k_Qn3TY-Ve18eE,15158
|
|
66
63
|
model_compression_toolkit/common/quantization/quantization_params_generation/kmeans_params.py,sha256=e8E7Htdc00mqATtHpOJUATadDY-LuHSUfJBh1-FLeKw,2648
|
|
@@ -70,8 +67,8 @@ model_compression_toolkit/common/quantization/quantization_params_generation/mae
|
|
|
70
67
|
model_compression_toolkit/common/quantization/quantization_params_generation/mse_selection.py,sha256=R2pBjOIeozczdVi-nqfQvy0Auj0QLP0XsgaCIH6DdMk,5420
|
|
71
68
|
model_compression_toolkit/common/quantization/quantization_params_generation/no_clipping.py,sha256=0TTU_rptXNjhldoH_K1-CE8eWEGq-EoSJPLlRM8dxUQ,6466
|
|
72
69
|
model_compression_toolkit/common/quantization/quantization_params_generation/outlier_filter.py,sha256=SeouwEGp5oQ9vZu6OxHKpw3Hu01mqYmCoS-xneLN4kk,1773
|
|
73
|
-
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_activations_computation.py,sha256=
|
|
74
|
-
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_computation.py,sha256=
|
|
70
|
+
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_activations_computation.py,sha256=4pHn5oX2vfzfiLv2g7YX925wnSnF0qd5o-q0VcLtbSI,3066
|
|
71
|
+
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_computation.py,sha256=OFrboVTE1D1taaP9a1tgY5P2FCvQkJaB4EvHoPZF4WE,4941
|
|
75
72
|
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_search.py,sha256=RP1ylMBISrCAxRVZfPoD6RC5msb-Y6bvrJN9lC8xKGk,8565
|
|
76
73
|
model_compression_toolkit/common/quantization/quantization_params_generation/qparams_weights_computation.py,sha256=G_IqFKpn4yVT6Q-uKbtJaF0N0QUxKvHeKdcNEGKlxwc,4943
|
|
77
74
|
model_compression_toolkit/common/quantization/quantizers/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
@@ -82,65 +79,64 @@ model_compression_toolkit/common/quantization/quantizers/quantizers_helpers.py,s
|
|
|
82
79
|
model_compression_toolkit/common/substitutions/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
83
80
|
model_compression_toolkit/common/substitutions/apply_substitutions.py,sha256=hfRgeqS873jMnF9CQJCUVMlElYX1tddGSFo1HfEOMuM,1459
|
|
84
81
|
model_compression_toolkit/common/visualization/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
85
|
-
model_compression_toolkit/common/visualization/tensorboard_writer.py,sha256=
|
|
82
|
+
model_compression_toolkit/common/visualization/tensorboard_writer.py,sha256=_aqRGqgZ7XcWK5gWl8aYFoMMk79K2Ex3c9aRvrqFAMI,16899
|
|
86
83
|
model_compression_toolkit/keras/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
87
|
-
model_compression_toolkit/keras/constants.py,sha256=
|
|
88
|
-
model_compression_toolkit/keras/default_framework_info.py,sha256=
|
|
89
|
-
model_compression_toolkit/keras/keras_implementation.py,sha256=
|
|
90
|
-
model_compression_toolkit/keras/
|
|
91
|
-
model_compression_toolkit/keras/
|
|
92
|
-
model_compression_toolkit/keras/quantization_facade.py,sha256=KoZvYxTssFTwZ_3DRTpwQKT7qxzDPMDiqCVrLXimBfg,13735
|
|
84
|
+
model_compression_toolkit/keras/constants.py,sha256=NbsC3VSuZ4Tl28o7FR5PFIJwG5y3iGhHbsqUM90gaFs,1418
|
|
85
|
+
model_compression_toolkit/keras/default_framework_info.py,sha256=_wZv6luoQOk4eaHGRHXasGVOKqZx5nGVwj3VCi4dPec,5188
|
|
86
|
+
model_compression_toolkit/keras/keras_implementation.py,sha256=FoGhblVhLN7aQtEp6VNJn1qBc56f9avlEYWOFlHAxko,10763
|
|
87
|
+
model_compression_toolkit/keras/quantization_facade.py,sha256=hYzQaVrhFcR0x4uBhDrb11_PN4OssRCqDY9Utgoexmg,13440
|
|
88
|
+
model_compression_toolkit/keras/tensor_marking.py,sha256=lfVqpVW3Pfb1BS7Q2d0yra3dFfKBsqGzy9CjkCfwnZA,5067
|
|
93
89
|
model_compression_toolkit/keras/back2framework/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
94
|
-
model_compression_toolkit/keras/back2framework/instance_builder.py,sha256=
|
|
95
|
-
model_compression_toolkit/keras/back2framework/model_builder.py,sha256=
|
|
90
|
+
model_compression_toolkit/keras/back2framework/instance_builder.py,sha256=PO_UaPVEWlKqfw8dexOdEeesQF_SUIACT_kGSLoDDHI,3344
|
|
91
|
+
model_compression_toolkit/keras/back2framework/model_builder.py,sha256=b4qnP2hDrLl6DU5gGHzgej7Ol2Wxp6ZdcCd0-Qos3jg,14531
|
|
96
92
|
model_compression_toolkit/keras/gradient_ptq/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
97
93
|
model_compression_toolkit/keras/gradient_ptq/gptq_loss.py,sha256=GGog0LDTb2_XptBjrlNjn2CJUlh6n7T32GNM1bMi5yo,1841
|
|
98
|
-
model_compression_toolkit/keras/gradient_ptq/graph_info.py,sha256=
|
|
99
|
-
model_compression_toolkit/keras/gradient_ptq/graph_update.py,sha256=
|
|
100
|
-
model_compression_toolkit/keras/gradient_ptq/training_wrapper.py,sha256=
|
|
94
|
+
model_compression_toolkit/keras/gradient_ptq/graph_info.py,sha256=3538-D-4u1K8nXQcOeDyC-8dcP1tEk7pfv2cbRXwvzE,3188
|
|
95
|
+
model_compression_toolkit/keras/gradient_ptq/graph_update.py,sha256=vdbO2ZyXR4tkMf47CCW67bxuxFp4uTrlVYwK_BHN4Pc,3405
|
|
96
|
+
model_compression_toolkit/keras/gradient_ptq/training_wrapper.py,sha256=38n9GKmig5-Ll8EPotJtVGY9h-6Tt9-onB6aq-67LNg,5991
|
|
101
97
|
model_compression_toolkit/keras/graph_substitutions/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
102
98
|
model_compression_toolkit/keras/graph_substitutions/substitutions/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
103
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/activation_decomposition.py,sha256=
|
|
104
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/batchnorm_folding.py,sha256=
|
|
105
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/input_scaling.py,sha256=
|
|
106
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/mark_activation.py,sha256=
|
|
107
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/relu_bound_correction.py,sha256=
|
|
108
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/remove_relu_upper_bound.py,sha256=
|
|
109
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/scale_equalization.py,sha256=
|
|
110
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/separableconv_decomposition.py,sha256=
|
|
111
|
-
model_compression_toolkit/keras/graph_substitutions/substitutions/shift_negative_activation.py,sha256=
|
|
99
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/activation_decomposition.py,sha256=S-Y3FBIk_IrigIsuJCENa23ZkRSq9PoTDvGe-_8snyY,3886
|
|
100
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/batchnorm_folding.py,sha256=U2OjwCZ2sfS_OR4SLVjtx5w79Fg6fte5pLyLU_ec_2Q,5190
|
|
101
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/input_scaling.py,sha256=KSR73RspupgO_ETr7BQWvvjjhRY86VEGtqDSN9ZeEYw,5184
|
|
102
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/mark_activation.py,sha256=uCZfrIWXw6OyihHV5UlGVy9S6HVnO1HHhZ6V5wmEFbM,3038
|
|
103
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/relu_bound_correction.py,sha256=ltBqOQKwRn3PNIKiFS62fmXi8aa3HA-WLYypWsIHXLs,5167
|
|
104
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/remove_relu_upper_bound.py,sha256=8wOjEGvTG2nAR5Zq2TSny_eeDep_8sYbDqyOT_xGtbY,2237
|
|
105
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/scale_equalization.py,sha256=nRMmqGMF-MJlp3dd6hGSSldGWq6P-wCvGyvSRClf_JI,15460
|
|
106
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/separableconv_decomposition.py,sha256=rL3dqnRXN7vj8PkBcdP73fwVV__BajBTRLMF8ilViBc,7609
|
|
107
|
+
model_compression_toolkit/keras/graph_substitutions/substitutions/shift_negative_activation.py,sha256=iBCF1K2lHCnVlmjaeE6GfbVRHZuH3jmQcGce9DOoYkQ,23234
|
|
112
108
|
model_compression_toolkit/keras/mixed_precision/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
113
|
-
model_compression_toolkit/keras/mixed_precision/sensitivity_evaluation.py,sha256=
|
|
109
|
+
model_compression_toolkit/keras/mixed_precision/sensitivity_evaluation.py,sha256=lb9pt4anZ4ZE5lRkwqN6OKA82Tcriy7o25OSJ3JLSPY,12753
|
|
114
110
|
model_compression_toolkit/keras/quantizer/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
115
111
|
model_compression_toolkit/keras/quantizer/base_quantizer.py,sha256=WoD4UrgXcCjZSXPnOX9slxJLrYDYN7go6nKs-bWjfuo,1735
|
|
116
|
-
model_compression_toolkit/keras/quantizer/fake_quant_builder.py,sha256=
|
|
112
|
+
model_compression_toolkit/keras/quantizer/fake_quant_builder.py,sha256=jtGyNrTGFt6PFoPG9eQA56eIKUDLsulDAsde7o0mx2A,3342
|
|
117
113
|
model_compression_toolkit/keras/quantizer/gradient_ptq/__init__.py,sha256=7PRuw9ayT3yXklOYNNv4MdiSc5dQlCVbMS4h3EkyyEw,1081
|
|
118
|
-
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer.py,sha256=
|
|
119
|
-
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer_gptq_config.py,sha256=
|
|
120
|
-
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_weight_quantizer_gptq_config.py,sha256=
|
|
114
|
+
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer.py,sha256=U-0bah9yTbNdUGfgqUdXwrmgMF1TafbppAxw6uE23Q4,8667
|
|
115
|
+
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_quantizer_gptq_config.py,sha256=Ht5sjWKlu9OnZaq2mHIRZQyGNy5DkhYD0wGtLUui71s,4210
|
|
116
|
+
model_compression_toolkit/keras/quantizer/gradient_ptq/activation_weight_quantizer_gptq_config.py,sha256=9Clxkudq98sfQvn5p6FKvcNSJMBdmpquPZN-Gr22q58,8660
|
|
121
117
|
model_compression_toolkit/keras/quantizer/gradient_ptq/base_quantizer_gptq_config.py,sha256=9Qac2Y5J82UsBELXilksn8-NejAUlUQx9NLtGHK2Zl0,2189
|
|
122
|
-
model_compression_toolkit/keras/quantizer/gradient_ptq/config_factory.py,sha256=
|
|
118
|
+
model_compression_toolkit/keras/quantizer/gradient_ptq/config_factory.py,sha256=1_hSRr6E1sT9ibZp--k5treqNyqNQjSxi2bhoEWYfzY,4399
|
|
123
119
|
model_compression_toolkit/keras/quantizer/gradient_ptq/utils.py,sha256=0iAjvi5uNedpH5ZtCcuJZx2YK0Gle7M7HQI5z0M4UBY,5092
|
|
124
120
|
model_compression_toolkit/keras/quantizer/gradient_ptq/weight_quantizer.py,sha256=z_17BT6OljXp3W1V9njnOs1pVfjHRnQTva2ZUq0U0NY,8299
|
|
125
|
-
model_compression_toolkit/keras/quantizer/gradient_ptq/weight_quantizer_gptq_config.py,sha256=
|
|
121
|
+
model_compression_toolkit/keras/quantizer/gradient_ptq/weight_quantizer_gptq_config.py,sha256=fb16XSZBoBFoEdIR4CzJijVoWkt5WrTlaf9mDjE_8Js,6931
|
|
126
122
|
model_compression_toolkit/keras/quantizer/mixed_precision/__init__.py,sha256=vXN-Q5V_3byIScc1j2ePqHBwR60knX1Vy6-Oh-Ke5sk,698
|
|
127
|
-
model_compression_toolkit/keras/quantizer/mixed_precision/quantization_config_factory.py,sha256=
|
|
123
|
+
model_compression_toolkit/keras/quantizer/mixed_precision/quantization_config_factory.py,sha256=fWXX3XgLxtMgnWV2w5vQxSz9P43k_H-vXxKhFFdd9xI,2563
|
|
128
124
|
model_compression_toolkit/keras/quantizer/mixed_precision/selective_quantizer.py,sha256=7FafdolmRzGQEOL4mRUAYS1xz4PCvSRxXsZYDcrpja0,8009
|
|
129
|
-
model_compression_toolkit/keras/quantizer/mixed_precision/selective_weights_quantize_config.py,sha256=
|
|
125
|
+
model_compression_toolkit/keras/quantizer/mixed_precision/selective_weights_quantize_config.py,sha256=zGiaXcUmbiNRIb2Q9E6BocyCL4cyQjuDpfguC9sFVf8,7521
|
|
130
126
|
model_compression_toolkit/keras/reader/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
131
|
-
model_compression_toolkit/keras/reader/common.py,sha256=
|
|
132
|
-
model_compression_toolkit/keras/reader/connectivity_handler.py,sha256=
|
|
133
|
-
model_compression_toolkit/keras/reader/node_builder.py,sha256=
|
|
134
|
-
model_compression_toolkit/keras/reader/reader.py,sha256=
|
|
127
|
+
model_compression_toolkit/keras/reader/common.py,sha256=KCsvLFOeFltb9NBqQ2nU0MHYVPDBCYDBKF3oeoaangg,2417
|
|
128
|
+
model_compression_toolkit/keras/reader/connectivity_handler.py,sha256=Pj4nmZl0C2K7iIbaC4PYS5Uvd82flvA9ctbI6DYYB7E,11115
|
|
129
|
+
model_compression_toolkit/keras/reader/node_builder.py,sha256=N9KSkY7AaZeq0-Zxi5MhKdCsTW2qmFp1yjqk5aPVPpA,3420
|
|
130
|
+
model_compression_toolkit/keras/reader/reader.py,sha256=0i9GT3rTWDDK5fKbtt6PTqFpM59obk8mK0SDXVbycn4,7939
|
|
135
131
|
model_compression_toolkit/keras/reader/nested_model/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
136
|
-
model_compression_toolkit/keras/reader/nested_model/edges_merger.py,sha256=
|
|
137
|
-
model_compression_toolkit/keras/reader/nested_model/nested_model_handler.py,sha256=
|
|
138
|
-
model_compression_toolkit/keras/reader/nested_model/nodes_merger.py,sha256=
|
|
139
|
-
model_compression_toolkit/keras/reader/nested_model/outputs_merger.py,sha256=
|
|
132
|
+
model_compression_toolkit/keras/reader/nested_model/edges_merger.py,sha256=6JFeMSSQ0dSXwMt2BM5Jvx3XZXXgOa3i7M4V_VjLRCU,7858
|
|
133
|
+
model_compression_toolkit/keras/reader/nested_model/nested_model_handler.py,sha256=vcv3oPZ4QvWmi9R37yY9ItV_9Pmd3KLjXFAgFQGC1Sg,2688
|
|
134
|
+
model_compression_toolkit/keras/reader/nested_model/nodes_merger.py,sha256=iI63gMLuE4_C-8aKSOLT3xRowViI3Je8aN8r5A37vy0,2167
|
|
135
|
+
model_compression_toolkit/keras/reader/nested_model/outputs_merger.py,sha256=bTzVEtXk-7zrtGN7_NZSAKSuCeBWTXd_sPe7RFYgHUQ,2381
|
|
140
136
|
model_compression_toolkit/keras/visualization/__init__.py,sha256=fpP2DhMfJXbHLoq20ziy48ymPyevl5N7P2U1fzlYRSY,699
|
|
141
|
-
model_compression_toolkit/keras/visualization/nn_visualizer.py,sha256=
|
|
142
|
-
mct_nightly-1.1.0.
|
|
143
|
-
mct_nightly-1.1.0.
|
|
144
|
-
mct_nightly-1.1.0.
|
|
145
|
-
mct_nightly-1.1.0.
|
|
146
|
-
mct_nightly-1.1.0.
|
|
137
|
+
model_compression_toolkit/keras/visualization/nn_visualizer.py,sha256=ya6r3l_O5i6RJCYMean8uoKiv8BXOMK9298nI-yBCe4,4789
|
|
138
|
+
mct_nightly-1.1.0.7122021.post2414.dist-info/LICENSE,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
|
139
|
+
mct_nightly-1.1.0.7122021.post2414.dist-info/METADATA,sha256=nFwNHOXdo4i3cb-Xh5K0hLR0U71bUxR6VbkhtT0esv4,5941
|
|
140
|
+
mct_nightly-1.1.0.7122021.post2414.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
|
141
|
+
mct_nightly-1.1.0.7122021.post2414.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
|
142
|
+
mct_nightly-1.1.0.7122021.post2414.dist-info/RECORD,,
|
|
@@ -16,9 +16,9 @@ from model_compression_toolkit.common.quantization import quantization_params_ge
|
|
|
16
16
|
from model_compression_toolkit.common.base_substitutions import BaseSubstitution
|
|
17
17
|
from model_compression_toolkit.common.framework_info import FrameworkInfo
|
|
18
18
|
from model_compression_toolkit.common.graph.base_graph import Graph
|
|
19
|
-
from model_compression_toolkit.common.graph.
|
|
19
|
+
from model_compression_toolkit.common.graph.node import Node
|
|
20
20
|
from model_compression_toolkit.common.logger import Logger
|
|
21
21
|
from model_compression_toolkit.common.quantization.quantization_config import QuantizationConfig, DEFAULTCONFIG
|
|
22
22
|
from model_compression_toolkit.common.quantization.quantizers.quantizers_helpers import power_of_two_constraint
|
|
23
|
-
from model_compression_toolkit.common.
|
|
23
|
+
from model_compression_toolkit.common.statistics_collector import StatsContainer, NoStatsContainer
|
|
24
24
|
|
|
@@ -16,7 +16,7 @@ import copy
|
|
|
16
16
|
|
|
17
17
|
from model_compression_toolkit.common.framework_implementation import FrameworkImplementation
|
|
18
18
|
from model_compression_toolkit.common.framework_info import FrameworkInfo
|
|
19
|
-
from model_compression_toolkit.common import Graph,
|
|
19
|
+
from model_compression_toolkit.common import Graph, Node
|
|
20
20
|
|
|
21
21
|
def apply_bias_correction_to_graph(graph_to_apply_bias_correction: Graph,
|
|
22
22
|
fw_info: FrameworkInfo,
|
|
@@ -44,7 +44,7 @@ def apply_bias_correction_to_graph(graph_to_apply_bias_correction: Graph,
|
|
|
44
44
|
return graph
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
def _apply_bias_correction_to_node(node:
|
|
47
|
+
def _apply_bias_correction_to_node(node:Node,
|
|
48
48
|
fw_impl: FrameworkImplementation):
|
|
49
49
|
"""
|
|
50
50
|
Set new bias to node using the bias-correction term that is stored in the
|
|
@@ -20,9 +20,9 @@ import numpy as np
|
|
|
20
20
|
|
|
21
21
|
from model_compression_toolkit.common.framework_implementation import FrameworkImplementation
|
|
22
22
|
from model_compression_toolkit.common.framework_info import FrameworkInfo
|
|
23
|
-
from model_compression_toolkit.common import
|
|
23
|
+
from model_compression_toolkit.common import Node, Logger, Graph
|
|
24
24
|
from model_compression_toolkit.common.quantization.quantize_node import get_quantized_kernel_by_weights_qc
|
|
25
|
-
from model_compression_toolkit.common.
|
|
25
|
+
from model_compression_toolkit.common.statistics_collector import BaseStatsContainer
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def compute_bias_correction_of_graph(graph_co_compute_bias: Graph,
|
|
@@ -53,9 +53,9 @@ def compute_bias_correction_of_graph(graph_co_compute_bias: Graph,
|
|
|
53
53
|
return graph
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def _compute_bias_correction_per_candidate_qc(node:
|
|
56
|
+
def _compute_bias_correction_per_candidate_qc(node: Node,
|
|
57
57
|
fw_info: FrameworkInfo,
|
|
58
|
-
node_in_stats_collector:
|
|
58
|
+
node_in_stats_collector: BaseStatsContainer,
|
|
59
59
|
fw_impl: FrameworkImplementation):
|
|
60
60
|
"""
|
|
61
61
|
For each candidate weights quantization configuration of a given node,
|
|
@@ -69,9 +69,9 @@ def _compute_bias_correction_per_candidate_qc(node: BaseNode,
|
|
|
69
69
|
|
|
70
70
|
"""
|
|
71
71
|
|
|
72
|
-
if node.
|
|
72
|
+
if node.candidates_weights_quantization_cfg is not None:
|
|
73
73
|
for weights_qc in node.candidates_weights_quantization_cfg:
|
|
74
|
-
if fw_info.in_kernel_ops(node):
|
|
74
|
+
if fw_info.in_kernel_ops(node) and weights_qc.enable_weights_quantization:
|
|
75
75
|
quantized_kernel, io_channels_axes = get_quantized_kernel_by_weights_qc(fw_info,
|
|
76
76
|
node,
|
|
77
77
|
weights_qc,
|
|
@@ -93,7 +93,7 @@ def _compute_bias_correction_per_candidate_qc(node: BaseNode,
|
|
|
93
93
|
|
|
94
94
|
def _compute_bias_correction(kernel: np.ndarray,
|
|
95
95
|
quantized_kernel: np.ndarray,
|
|
96
|
-
in_statistics_container:
|
|
96
|
+
in_statistics_container: BaseStatsContainer,
|
|
97
97
|
output_channels_axis: int,
|
|
98
98
|
input_channels: int) -> Any:
|
|
99
99
|
"""
|
|
@@ -132,8 +132,8 @@ def _compute_bias_correction(kernel: np.ndarray,
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
def _get_bias_correction_term_of_node(input_channels_axis: int,
|
|
135
|
-
n:
|
|
136
|
-
node_in_stats_collector:
|
|
135
|
+
n: Node,
|
|
136
|
+
node_in_stats_collector: BaseStatsContainer,
|
|
137
137
|
output_channels_axis: int,
|
|
138
138
|
quantized_kernel: np.ndarray,
|
|
139
139
|
fw_impl: FrameworkImplementation):
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
|
|
19
19
|
from model_compression_toolkit.common.collectors.base_collector import BaseCollector
|
|
20
|
-
from model_compression_toolkit.common.framework_info import ChannelAxis
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
class MeanCollector(BaseCollector):
|
|
@@ -27,7 +26,7 @@ class MeanCollector(BaseCollector):
|
|
|
27
26
|
"""
|
|
28
27
|
|
|
29
28
|
def __init__(self,
|
|
30
|
-
axis:
|
|
29
|
+
axis: int = -1,
|
|
31
30
|
beta: float = 0.99):
|
|
32
31
|
"""
|
|
33
32
|
Instantiate a per channel mean collector using a exponential moving average with bias correction.
|
|
@@ -91,7 +90,7 @@ class MeanCollector(BaseCollector):
|
|
|
91
90
|
"""
|
|
92
91
|
|
|
93
92
|
self.i += 1 # Update the iteration index
|
|
94
|
-
axis = (len(x.shape) - 1) if self.axis ==
|
|
93
|
+
axis = (len(x.shape) - 1) if self.axis == -1 else self.axis # convert
|
|
95
94
|
n = x.shape[axis]
|
|
96
95
|
transpose_index = [axis, *[i for i in range(len(x.shape)) if i != axis]]
|
|
97
96
|
mu = np.mean(np.reshape(np.transpose(x, transpose_index), [n, -1]), axis=-1) # compute mean per channel
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
|
|
18
18
|
from model_compression_toolkit.common.collectors.base_collector import BaseCollector
|
|
19
|
-
from model_compression_toolkit.common.framework_info import ChannelAxis
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
class MinMaxPerChannelCollector(BaseCollector):
|
|
@@ -25,15 +24,13 @@ class MinMaxPerChannelCollector(BaseCollector):
|
|
|
25
24
|
"""
|
|
26
25
|
|
|
27
26
|
def __init__(self,
|
|
28
|
-
axis: ChannelAxis,
|
|
29
27
|
init_min_value: float = None,
|
|
30
|
-
init_max_value: float = None
|
|
28
|
+
init_max_value: float = None,
|
|
29
|
+
axis=-1):
|
|
31
30
|
"""
|
|
32
31
|
Instantiate a collector for collecting min/max values of tensor per-channel.
|
|
33
32
|
Args:
|
|
34
33
|
axis: Compute the min/max values with regard to this axis.
|
|
35
|
-
init_max_value: Initial maximal output value.
|
|
36
|
-
init_min_value: Initial minimal output value.
|
|
37
34
|
"""
|
|
38
35
|
super().__init__()
|
|
39
36
|
self.axis = axis
|
|
@@ -130,7 +127,7 @@ class MinMaxPerChannelCollector(BaseCollector):
|
|
|
130
127
|
x: Tensor that goes through the collector and needs to be considered in the min/max computation.
|
|
131
128
|
"""
|
|
132
129
|
|
|
133
|
-
axis = (len(x.shape) - 1) if self.axis ==
|
|
130
|
+
axis = (len(x.shape) - 1) if self.axis == -1 else self.axis # convert
|
|
134
131
|
n = x.shape[axis]
|
|
135
132
|
transpose_index = [axis, *[i for i in range(len(x.shape)) if i != axis]]
|
|
136
133
|
x_reshape = np.reshape(np.transpose(x, transpose_index), [n, -1])
|
|
@@ -18,12 +18,10 @@ from typing import Callable, Any, List, Tuple
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
|
|
20
20
|
from model_compression_toolkit import common, GradientPTQConfig, MixedPrecisionQuantizationConfig
|
|
21
|
-
from model_compression_toolkit.common import
|
|
22
|
-
from model_compression_toolkit.common.collectors.statistics_collector import BaseStatsCollector
|
|
21
|
+
from model_compression_toolkit.common import Node
|
|
23
22
|
from model_compression_toolkit.common.framework_info import FrameworkInfo
|
|
24
23
|
from model_compression_toolkit.common.graph.base_graph import Graph
|
|
25
24
|
from model_compression_toolkit.common.model_builder_mode import ModelBuilderMode
|
|
26
|
-
from model_compression_toolkit.common.node_prior_info import NodePriorInfo
|
|
27
25
|
from model_compression_toolkit.common.quantization.quantization_config import QuantizationConfig
|
|
28
26
|
from model_compression_toolkit.common.user_info import UserInformation
|
|
29
27
|
|
|
@@ -112,14 +110,15 @@ class FrameworkImplementation(ABC):
|
|
|
112
110
|
f'framework\'s model_reader method.')
|
|
113
111
|
|
|
114
112
|
@abstractmethod
|
|
115
|
-
def attach_sc_to_node(self, node:
|
|
113
|
+
def attach_sc_to_node(self, node:Node,
|
|
114
|
+
fw_info:FrameworkInfo) -> common.statistics_collector.BaseStatsContainer:
|
|
116
115
|
"""
|
|
117
116
|
Return a statistics collector that should be attached to a node's output
|
|
118
117
|
during statistics collection.
|
|
119
118
|
|
|
120
119
|
Args:
|
|
121
120
|
node: Node to return its collector.
|
|
122
|
-
|
|
121
|
+
fw_info: FrameworkInfo object with information about the specific framework's model
|
|
123
122
|
|
|
124
123
|
Returns:
|
|
125
124
|
Statistics collector for the node.
|
|
@@ -148,6 +147,7 @@ class FrameworkImplementation(ABC):
|
|
|
148
147
|
raise NotImplemented(f'{self.__class__.__name__} have to implement the '
|
|
149
148
|
f'framework\'s get_substitutions_pre_statistics_collection method.')
|
|
150
149
|
|
|
150
|
+
|
|
151
151
|
@abstractmethod
|
|
152
152
|
def get_substitutions_pre_build(self) -> List[common.BaseSubstitution]:
|
|
153
153
|
"""
|
|
@@ -159,8 +159,7 @@ class FrameworkImplementation(ABC):
|
|
|
159
159
|
f'framework\'s get_substitutions_pre_build method.')
|
|
160
160
|
|
|
161
161
|
@abstractmethod
|
|
162
|
-
def get_substitutions_post_statistics_collection(self, quant_config:
|
|
163
|
-
common.BaseSubstitution]:
|
|
162
|
+
def get_substitutions_post_statistics_collection(self, quant_config:QuantizationConfig) -> List[common.BaseSubstitution]:
|
|
164
163
|
"""
|
|
165
164
|
Return a list of the framework substitutions used after we collect statistics.
|
|
166
165
|
|
|
@@ -237,19 +236,4 @@ class FrameworkImplementation(ABC):
|
|
|
237
236
|
raise NotImplemented(f'{self.__class__.__name__} have to implement the '
|
|
238
237
|
f'framework\'s get_sensitivity_evaluation_fn method.')
|
|
239
238
|
|
|
240
|
-
def get_node_prior_info(self, node: BaseNode,
|
|
241
|
-
fw_info: FrameworkInfo) -> NodePriorInfo:
|
|
242
|
-
"""
|
|
243
|
-
Get a NodePriorInfo object for a node.
|
|
244
|
-
|
|
245
|
-
Args:
|
|
246
|
-
node: Node to get its prior info.
|
|
247
|
-
fw_info: Framework specific information needed to create the prior info of the node.
|
|
248
|
-
|
|
249
|
-
Returns:
|
|
250
|
-
NodePriorInfo with information about the node.
|
|
251
|
-
"""
|
|
252
|
-
|
|
253
|
-
raise NotImplemented(f'{self.__class__.__name__} have to implement the '
|
|
254
|
-
f'framework\'s get_node_prior_info method.')
|
|
255
239
|
|
|
@@ -15,23 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
from collections import Callable
|
|
18
|
-
from enum import Enum
|
|
19
18
|
from typing import Dict, Any, List
|
|
20
|
-
|
|
21
|
-
from model_compression_toolkit.common.graph.functional_node import FunctionalNode
|
|
22
19
|
from model_compression_toolkit.common.quantization.quantization_config import QuantizationMethod
|
|
23
20
|
from model_compression_toolkit.common.defaultdict import DefaultDict
|
|
24
|
-
from model_compression_toolkit.common.graph.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class ChannelAxis(Enum):
|
|
28
|
-
"""
|
|
29
|
-
Index of output channel axis:
|
|
30
|
-
NHWC - Channels index is last.
|
|
31
|
-
NCHW - Channels index is 1.
|
|
32
|
-
"""
|
|
33
|
-
NHWC = -1
|
|
34
|
-
NCHW = 1
|
|
21
|
+
from model_compression_toolkit.common.graph.node import Node
|
|
35
22
|
|
|
36
23
|
|
|
37
24
|
class FrameworkInfo(object):
|
|
@@ -45,8 +32,7 @@ class FrameworkInfo(object):
|
|
|
45
32
|
kernel_channels_mapping: DefaultDict,
|
|
46
33
|
activation_min_max_mapping: Dict[str, tuple],
|
|
47
34
|
layer_min_max_mapping: Dict[Any, tuple],
|
|
48
|
-
kernel_ops_attributes_mapping: DefaultDict
|
|
49
|
-
output_channel_index: ChannelAxis):
|
|
35
|
+
kernel_ops_attributes_mapping: DefaultDict):
|
|
50
36
|
"""
|
|
51
37
|
A class to wrap all information about a specific framework the library needs to quantize a model.
|
|
52
38
|
Specifically, FrameworkInfo holds lists of layers by how they should be quantized, and multiple mappings such as
|
|
@@ -66,7 +52,6 @@ class FrameworkInfo(object):
|
|
|
66
52
|
activation_min_max_mapping (Dict[str, tuple]): Dictionary from an activation function to its min/max output values.
|
|
67
53
|
layer_min_max_mapping (Dict[Any, tuple]): Dictionary from a layer to its min/max output values.
|
|
68
54
|
kernel_ops_attributes_mapping (DefaultDict): Dictionary from a framework operator to a list of its weights attirbutes to quantize.
|
|
69
|
-
output_channel_index (ChannelAxis): Index of output channels of the model's layers (for computing statistics per-channel).
|
|
70
55
|
|
|
71
56
|
Examples:
|
|
72
57
|
When quantizing a Keras model, if we want to quantize the kernels of Conv2D layers only, we can
|
|
@@ -113,8 +98,6 @@ class FrameworkInfo(object):
|
|
|
113
98
|
self.activation_min_max_mapping = activation_min_max_mapping
|
|
114
99
|
self.layer_min_max_mapping = layer_min_max_mapping
|
|
115
100
|
self.kernel_ops_attributes_mapping = kernel_ops_attributes_mapping
|
|
116
|
-
self.output_channel_index = output_channel_index
|
|
117
|
-
|
|
118
101
|
|
|
119
102
|
def get_kernel_op_attributes(self, layer_class: Any) -> List[str]:
|
|
120
103
|
"""
|
|
@@ -141,20 +124,7 @@ class FrameworkInfo(object):
|
|
|
141
124
|
|
|
142
125
|
return layer in self.layer_min_max_mapping
|
|
143
126
|
|
|
144
|
-
def
|
|
145
|
-
"""
|
|
146
|
-
Check if an activation layer has a min/max mapping.
|
|
147
|
-
|
|
148
|
-
Args:
|
|
149
|
-
activation_name: String of the activation function to check for its min/max values.
|
|
150
|
-
|
|
151
|
-
Returns:
|
|
152
|
-
Whether an activation layer has a min/max known values or not.
|
|
153
|
-
"""
|
|
154
|
-
|
|
155
|
-
return activation_name in self.activation_min_max_mapping
|
|
156
|
-
|
|
157
|
-
def in_kernel_ops(self, n: BaseNode) -> bool:
|
|
127
|
+
def in_kernel_ops(self, n: Node) -> bool:
|
|
158
128
|
"""
|
|
159
129
|
Check whether a node is in the kernel_ops group or not.
|
|
160
130
|
|
|
@@ -167,7 +137,7 @@ class FrameworkInfo(object):
|
|
|
167
137
|
|
|
168
138
|
return n.layer_class in self.kernel_ops
|
|
169
139
|
|
|
170
|
-
def in_activation_ops(self, n:
|
|
140
|
+
def in_activation_ops(self, n: Node) -> bool:
|
|
171
141
|
"""
|
|
172
142
|
Check whether a node is in the activation group or not.
|
|
173
143
|
|
|
@@ -177,11 +147,10 @@ class FrameworkInfo(object):
|
|
|
177
147
|
Returns:
|
|
178
148
|
Whether the node is in the activation group or not.
|
|
179
149
|
"""
|
|
180
|
-
|
|
181
|
-
return n.functional_op in self.activation_ops
|
|
150
|
+
|
|
182
151
|
return n.layer_class in self.activation_ops
|
|
183
152
|
|
|
184
|
-
def in_no_quantization_ops(self, n:
|
|
153
|
+
def in_no_quantization_ops(self, n: Node) -> bool:
|
|
185
154
|
"""
|
|
186
155
|
Check whether a node is in the no quantization group or not.
|
|
187
156
|
|
|
@@ -191,6 +160,5 @@ class FrameworkInfo(object):
|
|
|
191
160
|
Returns:
|
|
192
161
|
Whether the node is in the no quantization group or not.
|
|
193
162
|
"""
|
|
194
|
-
|
|
195
|
-
return n.functional_op in self.no_quantization_ops
|
|
163
|
+
|
|
196
164
|
return n.layer_class in self.no_quantization_ops
|