code: def _get_end_layer_probs_for_skipping(nn, start_layer):
      """Returns the end layer probabilities to be used in skipping."""
      dists_from_ip = nn.get_distances_from_ip()
      dists_to_op = nn.get_distances_to_op()
      is_a_cnn = nn.nn_class.startswith("cnn")
      end_layer_prob = []
      for layer_idx, layer_label in enumerate(nn.layer_labels):
          curr_layer_prob = "assign"
          if (
              dists_from_ip[layer_idx] - 1 <= dists_from_ip[start_layer]
              or dists_to_op[layer_idx] + 1 >= dists_to_op[start_layer]
              or layer_label in ["ip", "op", "softmax"]
          ):
              curr_layer_prob = "no-assign"
          elif (
              is_a_cnn
              and nn.post_img_inv_sizes[start_layer]
              > nn.pre_img_inv_sizes[layer_idx]
          ):
              # If the layer has an input image size *larger* than the output of the
              # start layer, then do not assign.
              curr_layer_prob = "no-assign"
          elif layer_label == "fc":
              # If its a fully connected layer, connect with this only if it is the first
              # fc layer.
              curr_layer_parent_labels = [
                  nn.layer_labels[x] for x in nn.get_parents(layer_idx)
              ]
              if not all(
                  [
                      (
                          is_a_pooling_layer_label(clpl)
                          or is_a_conv_layer_label(clpl)
                      )
                      for clpl in curr_layer_parent_labels
                  ]
              ):
                  curr_layer_prob = "no-assign"
          curr_layer_prob = (
              0.0 if curr_layer_prob == "no-assign" else 1.0
          )
          end_layer_prob.append(curr_layer_prob)
      if sum(end_layer_prob) == 0:
          return None
      else:
          end_layer_prob = np.array(end_layer_prob)
          end_layer_prob = end_layer_prob / end_layer_prob.sum()
          return end_layer_prob
      return
  
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 15 for calling a global function with example usage: _get_end_layer_probs_for_skipping(nn, start_layer) and returns: None, end_layer_prob