code: def get_cnn_layer_label_mismatch_penalties(
      non_assignment_penalty, max_conv_size=7, conv_scale=None
  ):
      """Gets the label mismatch matrix for a CNN."""
      conv_scale = (
          np.sqrt(2) / 10.0 if conv_scale is None else conv_scale
      )
      cnn_layer_labels = neural_network.get_cnn_layer_labels(
          max_conv_size
      )
      num_labels = len(cnn_layer_labels)
      label_penalties = np.zeros((num_labels, num_labels))
      for i in range(num_labels):
          for j in range(i, num_labels):
              labi = cnn_layer_labels[i]
              labj = cnn_layer_labels[j]
              if labi == labj:
                  cost = 0.0
              elif (
                  labi.startswith("conv") and labj.startswith("conv")
              ) or (labi.startswith("res") and labj.startswith("res")):
                  cost = _get_conv_filter_size_cost(
                      labi, labj, conv_scale
                  )
              elif (
                  labi.startswith("conv") and labj.startswith("res")
              ) or (labi.startswith("res") and labj.startswith("conv")):
                  raw_cost = _get_conv_filter_size_cost(
                      labi, labj, conv_scale
                  )
                  cost = (
                      raw_cost
                      if raw_cost > non_assignment_penalty
                      else (
                          CONV_RES_RAW_COST_FRAC * raw_cost
                          + (1 - CONV_RES_RAW_COST_FRAC)
                          * non_assignment_penalty
                      )
                  )
                  # When mapping the a convolutional block to a residual block, set the cost
                  # to be in-between the cost for a conv-conv layer and the non_assignment_penalty.
              elif labi.endswith("pool") and labj.endswith("pool"):
                  cost = 0.5
              else:
                  cost = np.inf
              label_penalties[i, j] = cost * non_assignment_penalty
              label_penalties[j, i] = cost * non_assignment_penalty
      return cnn_layer_labels, label_penalties
  
imports: import numpy
  from .None import neural_network
  from ..gp.kernel import ExpSumOfDistsKernel, SumOfExpSumOfDistsKernel
  from ..utils.oper_utils import opt_transport
label_desc: Use image node_id 2 for calling a global function with example usage: get_cnn_layer_label_mismatch_penalties(non_assignment_penalty, max_conv_size, conv_scale) and returns: cnn_layer_labels,  label_penalties