mct-nightly 2.2.0.20240912.453__py3-none-any.whl → 2.2.0.20240913.457__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.2.0.20240912.453
3
+ Version: 2.2.0.20240913.457
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=MQHqvnJpE47tpv4ydHmi75LJ0XLa-WSNrWwOeRTKlwQ,1573
1
+ model_compression_toolkit/__init__.py,sha256=eh8nZeusPi2vtd5jkWwPc-8AdqWAwoMuMNlt2LN0xuI,1573
2
2
  model_compression_toolkit/constants.py,sha256=i4wYheBkIdQmsQA-axIpcT3YiSO1USNc-jaNiNE8w6E,3920
3
3
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
4
4
  model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
@@ -267,7 +267,7 @@ model_compression_toolkit/core/pytorch/quantizer/__init__.py,sha256=Rf1RcYmelmdZ
267
267
  model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py,sha256=D8_CEuFqKAhbUgKaRw7Jlxo0zlqgPTMu6CIIIM4LfS0,7045
268
268
  model_compression_toolkit/core/pytorch/quantizer/lut_fake_quant.py,sha256=uyeBtNokyDUikk-YkDP_mN_2DX0J5oPm3kSfdSUT2Ck,4420
269
269
  model_compression_toolkit/core/pytorch/reader/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
270
- model_compression_toolkit/core/pytorch/reader/graph_builders.py,sha256=NqWPGZzoYSg8I1n5ApgHr5xlwYTBMuvtOyXWjSTrePQ,15956
270
+ model_compression_toolkit/core/pytorch/reader/graph_builders.py,sha256=-EGSQOdww-O9x0jT_0ggqz2RcrRuDDaWTKnsWgQyxDI,16114
271
271
  model_compression_toolkit/core/pytorch/reader/node_holders.py,sha256=7XNc7-l1MZPJGcOESvtAwfIMxrU6kvt3YjF5B7qOqK4,1048
272
272
  model_compression_toolkit/core/pytorch/reader/reader.py,sha256=GEJE0QX8XJFWbYCkbRBtzttZtmmuoACLx8gw9KyAQCE,6015
273
273
  model_compression_toolkit/core/pytorch/statistics_correction/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
@@ -536,8 +536,8 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
536
536
  model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=bOc-hFL3gdoSM1Th_S2N_-9JJSlPGpZCTx_QLJHS6lg,3388
537
537
  model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
538
538
  model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
539
- mct_nightly-2.2.0.20240912.453.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
540
- mct_nightly-2.2.0.20240912.453.dist-info/METADATA,sha256=s63h4FLAEjfw0suj6RB6Td_lWn9sGzpmOA4CYE2GkiA,20813
541
- mct_nightly-2.2.0.20240912.453.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
542
- mct_nightly-2.2.0.20240912.453.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
543
- mct_nightly-2.2.0.20240912.453.dist-info/RECORD,,
539
+ mct_nightly-2.2.0.20240913.457.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
540
+ mct_nightly-2.2.0.20240913.457.dist-info/METADATA,sha256=vo0o2KRMxJWwI8BDGaaneBFXJV3oO_YwZeNr18IccXI,20813
541
+ mct_nightly-2.2.0.20240913.457.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
542
+ mct_nightly-2.2.0.20240913.457.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
543
+ mct_nightly-2.2.0.20240913.457.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.2.0.20240912.000453"
30
+ __version__ = "2.2.0.20240913.000457"
@@ -80,16 +80,19 @@ def _build_input_alloc_and_call_args(n: Node, input_tensors_in_node_kwargs: Dict
80
80
  tensor_input_alloc = []
81
81
  op_call_args = list(n.args)
82
82
  if inputs_as_list:
83
- op_call_args.pop(0)
83
+ # input tensors are a list in the first argument -> remove from op_call_args and go over
84
+ # the tensors in that list.
85
+ _args = op_call_args.pop(0)
84
86
  else:
85
- for in_node in n.all_input_nodes:
86
- # The extra for loop is used to tackle the case of the same input tensor for this node (e.g. torch.add(x, x)).
87
- for i, arg in enumerate(n.args):
88
- if arg == in_node:
89
- tensor_input_alloc.append(i)
90
- for k, arg in input_tensors_in_node_kwargs.items():
91
- if arg == in_node:
92
- tensor_input_alloc.append(k)
87
+ _args = n.args
88
+ for in_node in n.all_input_nodes:
89
+ # The extra for loop is used to tackle the case of the same input tensor for this node (e.g. torch.add(x, x)).
90
+ for i, arg in enumerate(_args):
91
+ if arg == in_node:
92
+ tensor_input_alloc.append(i)
93
+ for k, arg in input_tensors_in_node_kwargs.items():
94
+ if arg == in_node:
95
+ tensor_input_alloc.append(k)
93
96
 
94
97
  return op_call_args, tensor_input_alloc
95
98
 
@@ -253,11 +256,8 @@ def nodes_builder(model: GraphModule,
253
256
  node_kwargs[k] = v
254
257
 
255
258
  # Check if node's first input argument is a list of input fx nodes, such as torch.cat:
256
- is_first_input_list_of_nodes = is_instance_first_arg(node, (list, tuple)) and all(
259
+ inputs_as_list = is_instance_first_arg(node, (list, tuple)) and all(
257
260
  [isinstance(n, Node) for n in node.args[0]])
258
- is_placeholder_a_list = is_instance_first_arg(node, Node) and \
259
- node.args[0].op == PLACEHOLDER and node.args[0].meta[TYPE] in (list, tuple)
260
- inputs_as_list = is_first_input_list_of_nodes or is_placeholder_a_list
261
261
 
262
262
  # Build tensor_input_alloc required for the model builder. All input nodes are received as a list in the builder,
263
263
  # so tensor_input_alloc is used to allocate each input tensor in the correct place in the node's args & kwargs.
@@ -333,7 +333,12 @@ def edges_builder(model: GraphModule,
333
333
  if input_node in fx_node_2_graph_node:
334
334
  # n_edges_for_input_node is for the case that the input node appears more than
335
335
  # once as the input of the node, for example add(x, x)
336
- n_edges_for_input_node = sum([1 for a in node.args if input_node == a])
336
+ if node in fx_node_2_graph_node and isinstance(fx_node_2_graph_node[node], FunctionalNode) and \
337
+ fx_node_2_graph_node[node].inputs_as_list:
338
+ _args = node.args[0]
339
+ else:
340
+ _args = node.args
341
+ n_edges_for_input_node = sum([1 for a in _args if input_node == a])
337
342
  n_edges_for_input_node = max(n_edges_for_input_node, 1)
338
343
 
339
344
  dst_index = node.all_input_nodes.index(input_node)