docstr: Gather all sparse weights for a sibling group (to serve as input to the permutation search)
code: def collect_sparse_weights(
      cls, fx_graph, sibling_group, sibling_group_C_param
  ):
      """Gather all sparse weights for a sibling group (to serve as input to the permutation search)"""
  
      matrix_group = None
  
      for sibling in sibling_group:
          node_weight = cls.find_sparse_parameters_for_node(sibling)
  
          if node_weight is not None:
              # reshape due to siblings with grouped convolutions of different sizes
              assert (
                  node_weight.shape[1] % sibling_group_C_param == 0
              ), f"sibling {sibling}'s weights' C={node_weight.shape[1]} must be even multiple of the sibling group's C parameter {sibling_group_C_param}"
              node_weight = torch.reshape(
                  node_weight, (-1, sibling_group_C_param)
              )
  
              if matrix_group is None:
                  matrix_group = node_weight
              else:
                  try:
                      matrix_group = torch.cat(
                          (matrix_group, node_weight), dim=0
                      )  # concat the weights in the K dimension, keep the same C dimension
  
                  except:
                      if cls.__verbosity >= 0:
                          print(
                              "ERROR: [search_for_good_permutation][warning] cannot merge the weight for node: '{:}', with its weight shape: '{:}', the matrix_group shape: '{:}'.".format(
                                  sibling,
                                  node_weight.size(),
                                  matrix_group.size(),
                              )
                          )
                      continue
              if cls.__verbosity > 2:
                  print(
                      "[search_for_good_permutation] have merged the weight for node: '{:}', with its weight shape: '{:}', the matrix_group shape: '{:}'.".format(
                          sibling,
                          node_weight.size(),
                          matrix_group.size(),
                      )
                  )
          else:
              if cls.__verbosity > 2:
                  print(
                      f"[search_for_good_permutation] not adding dense weights for node {sibling} to the group"
                  )
  
      return matrix_group
  
imports: import os
  import torch
  import json
  import string
  import time
  import numpy
  import sys
  import builtins
  import io
label_desc: Use image node_id 15 for calling the Permutation obj's underlying member method code with example usage: obj.collect_sparse_weights(cls, fx_graph, sibling_group, sibling_group_C_param) and returns: matrix_group