mct-nightly 2.0.0.20240420.357__py3-none-any.whl → 2.0.0.20240422.447__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mct-nightly
3
- Version: 2.0.0.20240420.357
3
+ Version: 2.0.0.20240422.447
4
4
  Summary: A Model Compression Toolkit for neural networks
5
5
  Home-page: UNKNOWN
6
6
  License: UNKNOWN
@@ -1,4 +1,4 @@
1
- model_compression_toolkit/__init__.py,sha256=gvh2318G9DLCXx2UTaQecfi3Al3ts7uhk6s01F3-C4E,1573
1
+ model_compression_toolkit/__init__.py,sha256=4aTxYzMGKXE3itiRTf8qcOaLhdUjQybxG9JUGy6MrOA,1573
2
2
  model_compression_toolkit/constants.py,sha256=yIJyJ-e1WrDeKD9kG15qkqfYnoj7J1J2CxnJDt008ik,3756
3
3
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
4
4
  model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
@@ -135,7 +135,7 @@ model_compression_toolkit/core/common/substitutions/batchnorm_reconstruction.py,
135
135
  model_compression_toolkit/core/common/substitutions/batchnorm_refusing.py,sha256=YqLKiO5gFBEvI6noAWeMME1JHaYUaGFMglVFg8AqGjc,10028
136
136
  model_compression_toolkit/core/common/substitutions/linear_collapsing.py,sha256=iEtzbWCDXP6EDkTZCtREQ0rpMxhQ2kM9zlcP_0KLq9I,12367
137
137
  model_compression_toolkit/core/common/substitutions/linear_collapsing_substitution.py,sha256=uoauhmncQqUBNvD-qCLIXsIbl_IzrbxSKdxiMig-5W4,2406
138
- model_compression_toolkit/core/common/substitutions/remove_identity.py,sha256=LjkedR5fnXy4LCEQ7rnVTBI-cTkdDxXtufge5Llj2J0,2038
138
+ model_compression_toolkit/core/common/substitutions/remove_identity.py,sha256=VUWjc9Wo_nwSX3JTyAtrG5mprV90DwaQopAuvND30nQ,2353
139
139
  model_compression_toolkit/core/common/substitutions/residual_collapsing.py,sha256=doErjlMq-uSObYMSjA6IywSHb3Hz3QCc0HKU68ccrQ4,4767
140
140
  model_compression_toolkit/core/common/substitutions/scale_equalization.py,sha256=p57u25qdW2pimxzGwgMXEBV4S-LzXuTVAlIM7830WfU,10966
141
141
  model_compression_toolkit/core/common/substitutions/shift_negative_activation.py,sha256=cyy4qnlD-v1Gou62oHNDsf1hWLWkYfcjVv1otFrUltY,29865
@@ -483,8 +483,8 @@ model_compression_toolkit/trainable_infrastructure/keras/quantize_wrapper.py,sha
483
483
  model_compression_toolkit/trainable_infrastructure/keras/quantizer_utils.py,sha256=MVwXNymmFRB2NXIBx4e2mdJ1RfoHxRPYRgjb1MQP5kY,1797
484
484
  model_compression_toolkit/trainable_infrastructure/pytorch/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
485
485
  model_compression_toolkit/trainable_infrastructure/pytorch/base_pytorch_quantizer.py,sha256=7bbzqJN8ZAycVDvZr_5xC-niTAR5df8f03Kooev_pfg,3047
486
- mct_nightly-2.0.0.20240420.357.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
487
- mct_nightly-2.0.0.20240420.357.dist-info/METADATA,sha256=OE5OQ4BCc0NyZgJRBKfItUL4FwVpnaV9Om0mk3cSS8I,18795
488
- mct_nightly-2.0.0.20240420.357.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
489
- mct_nightly-2.0.0.20240420.357.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
490
- mct_nightly-2.0.0.20240420.357.dist-info/RECORD,,
486
+ mct_nightly-2.0.0.20240422.447.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
487
+ mct_nightly-2.0.0.20240422.447.dist-info/METADATA,sha256=-e_zF84B31zWmIPZVrAc6LPSQwmnUTTDcvg2Tb6-gyg,18795
488
+ mct_nightly-2.0.0.20240422.447.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
489
+ mct_nightly-2.0.0.20240422.447.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
490
+ mct_nightly-2.0.0.20240422.447.dist-info/RECORD,,
@@ -27,4 +27,4 @@ from model_compression_toolkit import data_generation
27
27
  from model_compression_toolkit import pruning
28
28
  from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model
29
29
 
30
- __version__ = "2.0.0.20240420.000357"
30
+ __version__ = "2.0.0.20240422.000447"
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from model_compression_toolkit.core.common.graph.base_graph import Graph
16
+ from model_compression_toolkit.core.common.graph.base_graph import Graph, OutTensor
17
17
  from model_compression_toolkit.core.common.graph.base_node import BaseNode
18
18
 
19
19
 
@@ -33,16 +33,24 @@ def remove_identity_node(graph: Graph,
33
33
  """
34
34
  # Retrieve the predecessor nodes of the identity node.
35
35
  prev_identity_nodes = graph.get_prev_nodes(node)
36
+
36
37
  # Ensure there is exactly one predecessor; otherwise, do nothing.
37
38
  if len(prev_identity_nodes) != 1:
38
39
  return graph
39
40
 
41
+ graph_outputs = graph.get_outputs()
42
+ for i, g_out in enumerate(graph_outputs):
43
+ if g_out.node == node:
44
+ graph_outputs[i] = OutTensor(node=prev_identity_nodes[0], node_out_index=g_out.node_out_index)
45
+
40
46
  # Reconnect the output edges of the identity node to its predecessor,
41
47
  # effectively bypassing the identity node.
42
48
  graph.reconnect_out_edges(current_node=node, new_node=prev_identity_nodes[0])
43
49
  # Remove the edge from the predecessor to the identity node.
44
50
  graph.remove_edge(prev_identity_nodes[0], node)
45
51
  # Remove the identity node from the graph.
46
- graph.remove_node(node_to_remove=node)
52
+ graph.remove_node(node_to_remove=node,
53
+ new_graph_outputs=graph_outputs
54
+ )
47
55
 
48
56
  return graph