original_docstring: 
      Train and evaluate a feedforward network with two hidden layers.
      
docstring: Train and evaluate a feedforward network with two hidden layers.
docstring_tokens: Train and evaluate a feedforward network with two hidden layers .
code: def cnn(train_x, train_y, test1_x, test1_y, test2_x, test2_y):
      """
      Train and evaluate a feedforward network with two hidden layers.
      """
      # Add a single "channels" dimension at the end
      trn_x = train_x.reshape([-1, 30, 30, 1])
      tst1_x = test1_x.reshape([-1, 30, 30, 1])
      tst2_x = test2_x.reshape([-1, 30, 30, 1])
  
      # First layer will need argument `input_shape=(30,30,1)`
      model = Sequential([
          # TODO: add your implementation here
          
          Conv2D(32, kernel_size = (5, 5), strides=(1, 1), activation='relu', input_shape=(30,30,1)),
  
          MaxPooling2D(pool_size=(2, 2), strides=(2, 2)),
  
          Conv2D(64, kernel_size = (5, 5), activation='relu'),
  
          MaxPooling2D(pool_size=(2, 2)),
  
          Flatten(),
          Dense(512, activation='relu'),
          Dense(10, activation='softmax')
      ])
  
      model.compile(optimizer='adam',
                    loss='categorical_crossentropy',
                    metrics=['accuracy'])
      model.fit(trn_x, train_y, epochs=5)
  
      print("Evaluating CNN on test set 1")
      model.evaluate(tst1_x, test1_y)
      print("Evaluating CNN on test set 2")
      return model.evaluate(tst2_x, test2_y)
code_tokens: def cnn ( train_x , train_y , test1_x , test1_y , test2_x , test2_y ) : trn_x = train_x . reshape ( [ - 1 , 30 , 30 , 1 ] ) tst1_x = test1_x . reshape ( [ - 1 , 30 , 30 , 1 ] ) tst2_x = test2_x . reshape ( [ - 1 , 30 , 30 , 1 ] ) model = Sequential ( [ Conv2D ( 32 , kernel_size = ( 5 , 5 ) , strides = ( 1 , 1 ) , activation = 'relu' , input_shape = ( 30 , 30 , 1 ) ) , MaxPooling2D ( pool_size = ( 2 , 2 ) , strides = ( 2 , 2 ) ) , Conv2D ( 64 , kernel_size = ( 5 , 5 ) , activation = 'relu' ) , MaxPooling2D ( pool_size = ( 2 , 2 ) ) , Flatten ( ) , Dense ( 512 , activation = 'relu' ) , Dense ( 10 , activation = 'softmax' ) ] ) model . compile ( optimizer = 'adam' , loss = 'categorical_crossentropy' , metrics = [ 'accuracy' ] ) model . fit ( trn_x , train_y , epochs = 5 ) print ( "Evaluating CNN on test set 1" ) model . evaluate ( tst1_x , test1_y ) print ( "Evaluating CNN on test set 2" ) return model . evaluate ( tst2_x , test2_y )
short_docstring: Train and evaluate a feedforward network with two hidden layers.
short_docstring_tokens: Train and evaluate a feedforward network with two hidden layers .
comment: """
      Train and evaluate a feedforward network with two hidden layers.
      """$SEP$# Add a single "channels" dimension at the end
  $SEP$# First layer will need argument `input_shape=(30,30,1)`
  $SEP$# TODO: add your implementation here
  