code: def generate_connections(
      num_total_layers: int,
      input_size: int,
      output_size: int,
      which_variant: str,
      num_nodes=0,
      feature_index=0,
      features_to_use=[],
  ):
      def fully_connected_constant():
          num_total_layers = (
              num_total_layers - 1
          )  # not including output layer
  
          genConns = []
  
          for i in range(0, num_total_layers):
              genConns.append(np.ones([input_size, num_nodes]).tolist())
  
          genConns.append(np.ones([num_nodes, output_size]).tolist())
          return genConns
  
      def diagonalized():
          # numLayers DOES include output layer
  
          numLayers_notInclOutput = num_total_layers - 1
          genConns = []
  
          for i in range(0, numLayers_notInclOutput):
              genConns.append(np.eye(input_size).tolist())
  
          genConns.append(np.ones([input_size, output_size]).tolist())
          return genConns
  
      def ladder_of_ladders():
          getConns = []
          numLayers_notIncOutput = (
              num_total_layers - 1
          )  # numLayers_notIncOutput = input_size
  
          for i in range(0, numLayers_notIncOutput):
              toAppend = np.ones([input_size, numLayers_notIncOutput])
              toAppend[
                  :, 0:i
              ] = 0  # toAppend[:, input_size-i:input_size] = 0
              getConns.append(
                  toAppend.tolist()
              )  # i added this tolist() on april 20th
  
          getConns.append(
              np.ones([numLayers_notIncOutput, output_size]).tolist()
          )
  
          return getConns
  
      def diagonalized_ladder_of_ladders_combined():
          # numLayers DOES include output layer
  
          # numLayers = numLadders in this case
  
          getConns = []
          numLayers_notIncOutput = (
              num_total_layers - 1
          )  # numLayers_notIncOutput = input_size
  
          for i in range(0, numLayers_notIncOutput):
              ladderOfLadders = np.ones(
                  [input_size, numLayers_notIncOutput]
              )
              ladderOfLadders[:, 0:i] = 0
              toAppend = np.append(
                  np.eye(input_size), ladderOfLadders, axis=1
              )
              getConns.append(toAppend.tolist())
          getConns.append(
              np.ones([len(getConns[-1][0]), output_size]).tolist()
          )
  
          return getConns
  
      def one_feature_diagonalized():
          # numLayers DOES include output layer
  
          numLayers_notInclOutput = num_total_layers - 1
          genConns = []
  
          for i in range(0, numLayers_notInclOutput):
              toAppend = np.zeros([input_size, 1])
              toAppend[feature_index][0] = 1
              genConns.append(toAppend.tolist())
  
          genConns.append(np.ones([1, output_size]).tolist())
  
          return genConns
  
      def n_feature_fully_connected():
          # numLayers DOES include output layer
  
          numLayers_notInclOutput = num_total_layers - 1
          features_not_to_use = []
          for i in range(0, input_size):
              if i not in features_to_use:
                  features_not_to_use.append(i)
          genConns = []
  
          for i in range(0, numLayers_notInclOutput):
              toAppend = np.ones([input_size, input_size])
              for num in features_not_to_use:
                  for j in range(0, input_size):
                      toAppend[j][num] = 0
                      toAppend[num][j] = 0
              genConns.append(toAppend.tolist())
  
          genConns.append(np.ones([input_size, output_size]).tolist())
  
          return genConns
  
      if which_variant == "fully_connected":
          return fully_connected_constant()
      elif which_variant == "diagonalized":
          return diagonalized()
      elif which_variant == "ladder_of_ladders":
          return ladder_of_ladders()
      elif which_variant == "diag_ladder_of_ladder_combined":
          return diagonalized_ladder_of_ladders_combined()
      elif which_variant == "one_feature_diag":
          return one_feature_diagonalized()
      elif which_variant == "n_feature_fully_connected":
          return n_feature_fully_connected()
      else:
          raise Exception(
              "You must choose one of the following four choices for which_variant: fully_connected, diagonalized, ladder_of_ladders, diag_ladder_of_ladder_combined, or one_feature_diag"
          )
  
imports: import numpy
  from sklearn.preprocessing import MinMaxScaler
  from tqdm import tqdm
  import pandas
  from torch.utils.data import Dataset
  import torch
  import torch.nn
  from torch.autograd import Function
  from torch.nn.parameter import Parameter
  import torch.nn.functional
  from sklearn.preprocessing import MinMaxScaler
  from sklearn.model_selection import train_test_split
  import torch.optim
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: generate_connections(num_total_layers, input_size, output_size, which_variant, num_nodes, feature_index, features_to_use) and returns: genConns, genConns, getConns, getConns, genConns, genConns, fully_connected_constant, diagonalized, ladder_of_ladders, diagonalized_ladder_of_ladders_combined, one_feature_diagonalized, n_feature_fully_connected