class_docstr: A class for modifying a neural nework using many of the operations above. 
class_docstr_tok: ["A","class","for","modifying","a","neural","nework","using","many","of","the","operations","above","."]
docstr: Returns the list of primitives grouped by type. 
docstr_tok: ["Returns","the","list","of","primitives","grouped","by","type","."]
code: def get_primitives_grouped_by_type(
      self, nn, types_of_primitives=None
  ):
      """Returns the list of primitives grouped by type."""
      # pylint: disable=bare-except
      # doing a bare except only for testing. Will remove soon.
      types_of_primitives = (
          types_of_primitives
          if types_of_primitives is not None
          else _PRIMITIVE_PROB_MASSES.keys()
      )
      ret = {}
      primitive_type_prob_masses = {}
      for top in types_of_primitives:
          top_is_of_known_type = True
          try:
              if top == "inc_single":
                  ret[top] = get_list_of_single_layer_modifiers(
                      nn,
                      "increase",
                      self.options.spawn_single_inc_num_units,
                      self.options.single_inc_change_frac,
                  )
              elif top == "dec_single":
                  ret[top] = get_list_of_single_layer_modifiers(
                      nn,
                      "decrease",
                      self.options.spawn_single_dec_num_units,
                      self.options.single_dec_change_frac,
                  )
              elif top == "inc_en_masse":
                  ret[top] = get_list_of_en_masse_change_primitives(
                      nn, "inc"
                  )
              elif top == "dec_en_masse":
                  ret[top] = get_list_of_en_masse_change_primitives(
                      nn, "dec"
                  )
              elif top == "swap_layer":
                  ret[top] = get_list_of_swap_layer_modifiers(nn)
              elif top == "wedge_layer":
                  ret[top] = get_list_of_wedge_layer_modifiers(nn)
              elif top == "remove_layer":
                  ret[top] = get_list_of_remove_layer_modifiers(nn)
              elif top == "branch":
                  ret[top] = get_list_of_branching_modifiers(nn)
              elif top == "skip":
                  ret[top] = get_list_of_skipping_modifiers(nn)
              else:
                  top_is_of_known_type = False
          except:
              pass
          if not top_is_of_known_type:
              raise ValueError(
                  "All values in types_of_primitives should be in %s. Given %s"
                  % (str(_PRIMITIVE_PROB_MASSES.keys()), top)
              )
          # Finally also add the probability mass
          primitive_type_prob_masses[top] = _PRIMITIVE_PROB_MASSES[top]
      return ret, primitive_type_prob_masses
  
imports: from argparse import Namespace
  from copy import deepcopy
  import numpy
  from .neural_network import ConvNeuralNetwork, MultiLayerPerceptron, MLP_RECTIFIERS, MLP_SIGMOIDS, is_a_pooling_layer_label, is_a_conv_layer_label, CNNImageSizeMismatchException, CNNNoConvAfterIPException
  from ..utils.general_utils import reorder_list_or_array, reorder_rows_and_cols_in_matrix
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 6 for calling the NNModifier obj's underlying member method code with example usage: obj.get_primitives_grouped_by_type(nn, types_of_primitives) and returns: ret,  primitive_type_prob_masses