Hi, I am trying to run channel pruning on my own TF model. The model has a encoder - decoder structure and makes use of Conv2dTranspose layers in the decoder.
I am getting the following error:
channel_pruning_auto_mode()
File "aimet_test.py", line 121, in channel_pruning_auto_mode
parameters=params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_tensorflow/compress.py", line 109, in compress_model
compressed_layer_db, stats = algo.compress_model(cost_metric, trainer)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/compression_algo.py", line 88, in compress_model
layer_comp_ratio_list, stats = self._comp_ratio_select_algo.select_per_layer_comp_ratios()
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/comp_ratio_select.py", line 223, in select_per_layer_comp_ratios
eval_scores_dict = self._construct_eval_dict()
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/comp_ratio_select.py", line 214, in _construct_eval_dict
eval_scores_dict = self._compute_eval_scores_for_all_comp_ratio_candidates()
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/comp_ratio_select.py", line 400, in _compute_eval_scores_for_all_comp_ratio_candidates
progress_bar, layer)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/comp_ratio_select.py", line 429, in _compute_layerwise_eval_score_per_comp_ratio_candidate
trainer=None)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_tensorflow/channel_pruning/channel_pruner.py", line 260, in prune_model
in_place=True, verbose=False)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_tensorflow/winnow/winnow.py", line 71, in winnow_tf_model
in_place, verbose)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_tensorflow/winnow/mask_propagation_winnower.py", line 88, in __init__
self._mask_propagator = MaskPropagator(self._conn_graph, model_api=ModelApi.tensorflow)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/winnow/mask_propagator.py", line 77, in __init__
self._create_masks()
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/winnow/mask_propagator.py", line 91, in _create_masks
self._create_masks_for_op_and_all_ancestors(op)
File "/home/ubuntu/.local/lib/python3.6/site-packages/aimet_common/winnow/mask_propagator.py", line 116, in _create_masks_for_op_and_all_ancestors
current_op.num_in_channels = input_shape[api_channel_index_dict[self._model_api]]
File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/tensor_shape.py", line 870, in __getitem__
return self._dims[key]
IndexError: list index out of range
By adding some print outs to AIMET’s mask_propagator.py, it became clear that the problem is indeed related to the Conv2DTranspose layers. When the exception is triggered current_op.inputs[0] is pointing to convTr9/mul_1_to_convTr9/stack in my model (a Conv2dTranspose layer), and the input_shape is ().
I have tried adding all the Conv2DTranspose layers to the modules_to_ignore list but this does not seem to help.
I do realize that without the full model it will be difficult to exactly pinpoint the problem, but is there any recommendation on how to deal with this issue?
Thanks