original_docstring: 
      Removes the second part of the GoogleNet for inserting it into the second stage.
      :param stage1:
      :param stage2:
      :return:
      
docstring: Removes the second part of the GoogleNet for inserting it into the second stage.
docstring_tokens: Removes the second part of the GoogleNet for inserting it into the second stage .
code: def prepareGoogleNet_Stage2(stage1, stage2):
      """
      Removes the second part of the GoogleNet for inserting it into the second stage.
      :param stage1:
      :param stage2:
      :return:
      """
      # Remove all last layers (from 'inception_5a' included)
      layers_to_delete = ['inception_5a/1x1', 'inception_5a/relu_1x1',
                          'inception_5a/3x3_reduce',
                          'inception_5a/relu_3x3_reduce',
                          'inception_5a/3x3_zeropadding', 'inception_5a/3x3',
                          'inception_5a/relu_3x3',
                          'inception_5a/5x5_reduce',
                          'inception_5a/relu_5x5_reduce',
                          'inception_5a/5x5_zeropadding', 'inception_5a/5x5',
                          'inception_5a/relu_5x5',
                          'inception_5a/pool_zeropadding', 'inception_5a/pool',
                          'inception_5a/pool_proj',
                          'inception_5a/relu_pool_proj',
                          'inception_5a/output', 'inception_5b/1x1',
                          'inception_5b/relu_1x1', 'inception_5b/3x3_reduce',
                          'inception_5b/relu_3x3_reduce',
                          'inception_5b/3x3_zeropadding', 'inception_5b/3x3',
                          'inception_5b/relu_3x3',
                          'inception_5b/5x5_reduce',
                          'inception_5b/relu_5x5_reduce',
                          'inception_5b/5x5_zeropadding', 'inception_5b/5x5',
                          'inception_5b/relu_5x5',
                          'inception_5b/pool_zeropadding', 'inception_5b/pool',
                          'inception_5b/pool_proj',
                          'inception_5b/relu_pool_proj',
                          'inception_5b/output', 'pool5/7x7_s1', 'pool5/drop_7x7_s1',
                          'loss3/classifier_foodrecognition_flatten',
                          'loss3/classifier_foodrecognition', 'output_loss3/loss3']
      [layers, params] = stage1.removeLayers(copy.copy(layers_to_delete))
      # Remove softmax output
      stage1.removeOutputs(['loss3/loss3'])
  
      layers_to_delete_2 = ["conv1/7x7_s2_zeropadding", "conv1/7x7_s2",
                            "conv1/relu_7x7", "pool1/3x3_s2_zeropadding",
                            "pool1/3x3_s2", "pool1/norm1", "conv2/3x3_reduce",
                            "conv2/relu_3x3_reduce",
                            "conv2/3x3_zeropadding", "conv2/3x3", "conv2/relu_3x3",
                            "conv2/norm2",
                            "pool2/3x3_s2_zeropadding", "pool2/3x3_s2",
                            "inception_3a/1x1", "inception_3a/relu_1x1",
                            "inception_3a/3x3_reduce", "inception_3a/relu_3x3_reduce",
                            "inception_3a/3x3_zeropadding",
                            "inception_3a/3x3", "inception_3a/relu_3x3",
                            "inception_3a/5x5_reduce",
                            "inception_3a/relu_5x5_reduce",
                            "inception_3a/5x5_zeropadding", "inception_3a/5x5",
                            "inception_3a/relu_5x5", "inception_3a/pool_zeropadding",
                            "inception_3a/pool",
                            "inception_3a/pool_proj", "inception_3a/relu_pool_proj",
                            "inception_3a/output",
                            "inception_3b/1x1", "inception_3b/relu_1x1",
                            "inception_3b/3x3_reduce",
                            "inception_3b/relu_3x3_reduce",
                            "inception_3b/3x3_zeropadding", "inception_3b/3x3",
                            "inception_3b/relu_3x3", "inception_3b/5x5_reduce",
                            "inception_3b/relu_5x5_reduce",
                            "inception_3b/5x5_zeropadding", "inception_3b/5x5",
                            "inception_3b/relu_5x5",
                            "inception_3b/pool_zeropadding", "inception_3b/pool",
                            "inception_3b/pool_proj",
                            "inception_3b/relu_pool_proj", "inception_3b/output",
                            "pool3/3x3_s2_zeropadding",
                            "pool3/3x3_s2", "inception_4a/1x1",
                            "inception_4a/relu_1x1", "inception_4a/3x3_reduce",
                            "inception_4a/relu_3x3_reduce",
                            "inception_4a/3x3_zeropadding", "inception_4a/3x3",
                            "inception_4a/relu_3x3", "inception_4a/5x5_reduce",
                            "inception_4a/relu_5x5_reduce",
                            "inception_4a/5x5_zeropadding", "inception_4a/5x5",
                            "inception_4a/relu_5x5",
                            "inception_4a/pool_zeropadding", "inception_4a/pool",
                            "inception_4a/pool_proj",
                            "inception_4a/relu_pool_proj", "inception_4a/output",
                            "inception_4b/1x1",
                            "inception_4b/relu_1x1", "inception_4b/3x3_reduce",
                            "inception_4b/relu_3x3_reduce",
                            "inception_4b/3x3_zeropadding", "inception_4b/3x3",
                            "inception_4b/relu_3x3",
                            "inception_4b/5x5_reduce", "inception_4b/relu_5x5_reduce",
                            "inception_4b/5x5_zeropadding",
                            "inception_4b/5x5", "inception_4b/relu_5x5",
                            "inception_4b/pool_zeropadding",
                            "inception_4b/pool", "inception_4b/pool_proj",
                            "inception_4b/relu_pool_proj",
                            "inception_4b/output", "inception_4c/1x1",
                            "inception_4c/relu_1x1", "inception_4c/3x3_reduce",
                            "inception_4c/relu_3x3_reduce",
                            "inception_4c/3x3_zeropadding", "inception_4c/3x3",
                            "inception_4c/relu_3x3", "inception_4c/5x5_reduce",
                            "inception_4c/relu_5x5_reduce",
                            "inception_4c/5x5_zeropadding", "inception_4c/5x5",
                            "inception_4c/relu_5x5",
                            "inception_4c/pool_zeropadding", "inception_4c/pool",
                            "inception_4c/pool_proj",
                            "inception_4c/relu_pool_proj", "inception_4c/output",
                            "inception_4d/1x1",
                            "inception_4d/relu_1x1", "inception_4d/3x3_reduce",
                            "inception_4d/relu_3x3_reduce",
                            "inception_4d/3x3_zeropadding", "inception_4d/3x3",
                            "inception_4d/relu_3x3",
                            "inception_4d/5x5_reduce", "inception_4d/relu_5x5_reduce",
                            "inception_4d/5x5_zeropadding",
                            "inception_4d/5x5", "inception_4d/relu_5x5",
                            "inception_4d/pool_zeropadding",
                            "inception_4d/pool", "inception_4d/pool_proj",
                            "inception_4d/relu_pool_proj",
                            "inception_4d/output", "inception_4e/1x1",
                            "inception_4e/relu_1x1", "inception_4e/3x3_reduce",
                            "inception_4e/relu_3x3_reduce",
                            "inception_4e/3x3_zeropadding", "inception_4e/3x3",
                            "inception_4e/relu_3x3", "inception_4e/5x5_reduce",
                            "inception_4e/relu_5x5_reduce",
                            "inception_4e/5x5_zeropadding", "inception_4e/5x5",
                            "inception_4e/relu_5x5",
                            "inception_4e/pool_zeropadding", "inception_4e/pool",
                            "inception_4e/pool_proj",
                            "inception_4e/relu_pool_proj", "inception_4e/output",
                            "pool4/3x3_s2_zeropadding",
                            "pool4/3x3_s2"]
  
      # Remove initial layers
      [layers_, params_] = stage2.removeLayers(copy.copy(layers_to_delete_2))
      # Remove previous input
      stage2.removeInputs(['input_data'])
      # Add new input
      stage2.model.add_input(name='input_data', input_shape=(832, 7, 7))
      stage2.model.nodes[layers_to_delete[0]].previous = stage2.model.inputs[
          'input_data']
      """
      # Insert layers into stage
       stage2.model = Graph()
      # Input
       stage2.model.add_input(name='input_data', input_shape=(832,7,7))
       for l_name,l,p in zip(layers_to_delete, layers, params):
          stage2.model.namespace.add(l_name)
          stage2.model.nodes[l_name] = l
          stage2.model.node_config.append(p)
      #input = stage2.model.input # keep input
      # Connect first layer with input
       stage2.model.node_config[0]['input'] = 'input_data'
       stage2.model.nodes[layers_to_delete[0]].previous = stage2.model.inputs['input_data']
       stage2.model.input_config[0]['input_shape'] = [832,7,7]
  
      # Output
       stage2.model.add_output(name='loss3/loss3', input=layers_to_delete[-1])
      #stage2.model.add_output(name='loss3/loss3_', input=layers_to_delete[-1])
      #stage2.model.input = input # recover input
      """
code_tokens: def prepareGoogleNet_Stage2 ( stage1 , stage2 ) : layers_to_delete = [ 'inception_5a/1x1' , 'inception_5a/relu_1x1' , 'inception_5a/3x3_reduce' , 'inception_5a/relu_3x3_reduce' , 'inception_5a/3x3_zeropadding' , 'inception_5a/3x3' , 'inception_5a/relu_3x3' , 'inception_5a/5x5_reduce' , 'inception_5a/relu_5x5_reduce' , 'inception_5a/5x5_zeropadding' , 'inception_5a/5x5' , 'inception_5a/relu_5x5' , 'inception_5a/pool_zeropadding' , 'inception_5a/pool' , 'inception_5a/pool_proj' , 'inception_5a/relu_pool_proj' , 'inception_5a/output' , 'inception_5b/1x1' , 'inception_5b/relu_1x1' , 'inception_5b/3x3_reduce' , 'inception_5b/relu_3x3_reduce' , 'inception_5b/3x3_zeropadding' , 'inception_5b/3x3' , 'inception_5b/relu_3x3' , 'inception_5b/5x5_reduce' , 'inception_5b/relu_5x5_reduce' , 'inception_5b/5x5_zeropadding' , 'inception_5b/5x5' , 'inception_5b/relu_5x5' , 'inception_5b/pool_zeropadding' , 'inception_5b/pool' , 'inception_5b/pool_proj' , 'inception_5b/relu_pool_proj' , 'inception_5b/output' , 'pool5/7x7_s1' , 'pool5/drop_7x7_s1' , 'loss3/classifier_foodrecognition_flatten' , 'loss3/classifier_foodrecognition' , 'output_loss3/loss3' ] [ layers , params ] = stage1 . removeLayers ( copy . copy ( layers_to_delete ) ) stage1 . removeOutputs ( [ 'loss3/loss3' ] ) layers_to_delete_2 = [ "conv1/7x7_s2_zeropadding" , "conv1/7x7_s2" , "conv1/relu_7x7" , "pool1/3x3_s2_zeropadding" , "pool1/3x3_s2" , "pool1/norm1" , "conv2/3x3_reduce" , "conv2/relu_3x3_reduce" , "conv2/3x3_zeropadding" , "conv2/3x3" , "conv2/relu_3x3" , "conv2/norm2" , "pool2/3x3_s2_zeropadding" , "pool2/3x3_s2" , "inception_3a/1x1" , "inception_3a/relu_1x1" , "inception_3a/3x3_reduce" , "inception_3a/relu_3x3_reduce" , "inception_3a/3x3_zeropadding" , "inception_3a/3x3" , "inception_3a/relu_3x3" , "inception_3a/5x5_reduce" , "inception_3a/relu_5x5_reduce" , "inception_3a/5x5_zeropadding" , "inception_3a/5x5" , "inception_3a/relu_5x5" , "inception_3a/pool_zeropadding" , "inception_3a/pool" , "inception_3a/pool_proj" , "inception_3a/relu_pool_proj" , "inception_3a/output" , "inception_3b/1x1" , "inception_3b/relu_1x1" , "inception_3b/3x3_reduce" , "inception_3b/relu_3x3_reduce" , "inception_3b/3x3_zeropadding" , "inception_3b/3x3" , "inception_3b/relu_3x3" , "inception_3b/5x5_reduce" , "inception_3b/relu_5x5_reduce" , "inception_3b/5x5_zeropadding" , "inception_3b/5x5" , "inception_3b/relu_5x5" , "inception_3b/pool_zeropadding" , "inception_3b/pool" , "inception_3b/pool_proj" , "inception_3b/relu_pool_proj" , "inception_3b/output" , "pool3/3x3_s2_zeropadding" , "pool3/3x3_s2" , "inception_4a/1x1" , "inception_4a/relu_1x1" , "inception_4a/3x3_reduce" , "inception_4a/relu_3x3_reduce" , "inception_4a/3x3_zeropadding" , "inception_4a/3x3" , "inception_4a/relu_3x3" , "inception_4a/5x5_reduce" , "inception_4a/relu_5x5_reduce" , "inception_4a/5x5_zeropadding" , "inception_4a/5x5" , "inception_4a/relu_5x5" , "inception_4a/pool_zeropadding" , "inception_4a/pool" , "inception_4a/pool_proj" , "inception_4a/relu_pool_proj" , "inception_4a/output" , "inception_4b/1x1" , "inception_4b/relu_1x1" , "inception_4b/3x3_reduce" , "inception_4b/relu_3x3_reduce" , "inception_4b/3x3_zeropadding" , "inception_4b/3x3" , "inception_4b/relu_3x3" , "inception_4b/5x5_reduce" , "inception_4b/relu_5x5_reduce" , "inception_4b/5x5_zeropadding" , "inception_4b/5x5" , "inception_4b/relu_5x5" , "inception_4b/pool_zeropadding" , "inception_4b/pool" , "inception_4b/pool_proj" , "inception_4b/relu_pool_proj" , "inception_4b/output" , "inception_4c/1x1" , "inception_4c/relu_1x1" , "inception_4c/3x3_reduce" , "inception_4c/relu_3x3_reduce" , "inception_4c/3x3_zeropadding" , "inception_4c/3x3" , "inception_4c/relu_3x3" , "inception_4c/5x5_reduce" , "inception_4c/relu_5x5_reduce" , "inception_4c/5x5_zeropadding" , "inception_4c/5x5" , "inception_4c/relu_5x5" , "inception_4c/pool_zeropadding" , "inception_4c/pool" , "inception_4c/pool_proj" , "inception_4c/relu_pool_proj" , "inception_4c/output" , "inception_4d/1x1" , "inception_4d/relu_1x1" , "inception_4d/3x3_reduce" , "inception_4d/relu_3x3_reduce" , "inception_4d/3x3_zeropadding" , "inception_4d/3x3" , "inception_4d/relu_3x3" , "inception_4d/5x5_reduce" , "inception_4d/relu_5x5_reduce" , "inception_4d/5x5_zeropadding" , "inception_4d/5x5" , "inception_4d/relu_5x5" , "inception_4d/pool_zeropadding" , "inception_4d/pool" , "inception_4d/pool_proj" , "inception_4d/relu_pool_proj" , "inception_4d/output" , "inception_4e/1x1" , "inception_4e/relu_1x1" , "inception_4e/3x3_reduce" , "inception_4e/relu_3x3_reduce" , "inception_4e/3x3_zeropadding" , "inception_4e/3x3" , "inception_4e/relu_3x3" , "inception_4e/5x5_reduce" , "inception_4e/relu_5x5_reduce" , "inception_4e/5x5_zeropadding" , "inception_4e/5x5" , "inception_4e/relu_5x5" , "inception_4e/pool_zeropadding" , "inception_4e/pool" , "inception_4e/pool_proj" , "inception_4e/relu_pool_proj" , "inception_4e/output" , "pool4/3x3_s2_zeropadding" , "pool4/3x3_s2" ] [ layers_ , params_ ] = stage2 . removeLayers ( copy . copy ( layers_to_delete_2 ) ) stage2 . removeInputs ( [ 'input_data' ] ) stage2 . model . add_input ( name = 'input_data' , input_shape = ( 832 , 7 , 7 ) ) stage2 . model . nodes [ layers_to_delete [ 0 ] ] . previous = stage2 . model . inputs [ 'input_data' ] """
      # Insert layers into stage
       stage2.model = Graph()
      # Input
       stage2.model.add_input(name='input_data', input_shape=(832,7,7))
       for l_name,l,p in zip(layers_to_delete, layers, params):
          stage2.model.namespace.add(l_name)
          stage2.model.nodes[l_name] = l
          stage2.model.node_config.append(p)
      #input = stage2.model.input # keep input
      # Connect first layer with input
       stage2.model.node_config[0]['input'] = 'input_data'
       stage2.model.nodes[layers_to_delete[0]].previous = stage2.model.inputs['input_data']
       stage2.model.input_config[0]['input_shape'] = [832,7,7]
  
      # Output
       stage2.model.add_output(name='loss3/loss3', input=layers_to_delete[-1])
      #stage2.model.add_output(name='loss3/loss3_', input=layers_to_delete[-1])
      #stage2.model.input = input # recover input
      """
short_docstring: Removes the second part of the GoogleNet for inserting it into the second stage.
short_docstring_tokens: Removes the second part of the GoogleNet for inserting it into the second stage .
comment: """
      Removes the second part of the GoogleNet for inserting it into the second stage.
      :param stage1:
      :param stage2:
      :return:
      """$SEP$# Remove all last layers (from 'inception_5a' included)$SEP$# Remove softmax output$SEP$# Remove initial layers$SEP$# Remove previous input$SEP$# Add new input$SEP$"""
      # Insert layers into stage
       stage2.model = Graph()
      # Input
       stage2.model.add_input(name='input_data', input_shape=(832,7,7))
       for l_name,l,p in zip(layers_to_delete, layers, params):
          stage2.model.namespace.add(l_name)
          stage2.model.nodes[l_name] = l
          stage2.model.node_config.append(p)
      #input = stage2.model.input # keep input
      # Connect first layer with input
       stage2.model.node_config[0]['input'] = 'input_data'
       stage2.model.nodes[layers_to_delete[0]].previous = stage2.model.inputs['input_data']
       stage2.model.input_config[0]['input_shape'] = [832,7,7]
  
      # Output
       stage2.model.add_output(name='loss3/loss3', input=layers_to_delete[-1])
      #stage2.model.add_output(name='loss3/loss3_', input=layers_to_delete[-1])
      #stage2.model.input = input # recover input
      """