def runOutputLayerTests(self): tests.test_output(output) ############################## ## Build the Neural Network ## ############################## # Remove previous weights, bias, inputs, etc.. tests.test_conv_net(conv_net) print("Model OutputLayerTests Ran Successfully")
def test_implementation(): tf.reset_default_graph() tests.test_nn_image_inputs(neural_net_image_input) tests.test_nn_label_inputs(neural_net_label_input) tests.test_nn_keep_prob_inputs(neural_net_keep_prob_input) tests.test_con_pool(conv2d_maxpool) tests.test_flatten(flatten) tests.test_fully_conn(fully_conn) tests.test_output(output) build_cnn() tests.test_conv_net(conv_net) tests.test_train_nn(train_neural_network)
def run_tests(): import problem_unittests as t t.test_folder_path(cifar10_dataset_folder_path) t.test_normalize(normalize) t.test_one_hot_encode(one_hot_encode) t.test_nn_image_inputs(neural_net_image_input) t.test_nn_label_inputs(neural_net_label_input) t.test_nn_keep_prob_inputs(neural_net_keep_prob_input) t.test_con_pool(conv2conv2d_maxpool) t.test_flatten(flatten) t.test_fully_conn(fully_conn) t.test_output(output) t.test_conv_net(conv_net) t.test_train_nn(train_neural_network)
""" Apply a output layer to x_tensor using weight and bias : x_tensor: A 2-D tensor where the first dimension is batch size. : num_outputs: The number of output that the new tensor should be. : return: A 2-D tensor where the second dimension is num_outputs. """ # TODO: Implement Function output_layer = tf.layers.dense(x_tensor, num_outputs, activation=None) return output_layer """ DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ tests.test_output(output) # ### Create Convolutional Model # Implement the function `conv_net` to create a convolutional neural network model. The function takes in a batch of images, `x`, and outputs logits. Use the layers you created above to create this model: # # * Apply 1, 2, or 3 Convolution and Max Pool layers # * Apply a Flatten Layer # * Apply 1, 2, or 3 Fully Connected Layers # * Apply an Output Layer # * Return the output # * Apply [TensorFlow's Dropout](https://www.tensorflow.org/api_docs/python/tf/nn/dropout) to one or more layers in the model using `keep_prob`. # In[ ]:
: return: A 2-D tensor where the second dimension is num_outputs. """ # TODO: Implement Function input_size = x_tensor.get_shape().as_list()[1] output_size = num_outputs weights = tf.Variable(tf.truncated_normal([input_size, output_size], mean = 0.0, stddev = 1.0/input_size)) biases = tf.Variable(tf.zeros(num_outputs)) out = tf.add(tf.matmul(x_tensor, weights), biases) return out """ DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ tests.test_output(output) # ### Create Convolutional Model # Implement the function `conv_net` to create a convolutional neural network model. The function takes in a batch of images, `x`, and outputs logits. Use the layers you created above to create this model: # # * Apply 1, 2, or 3 Convolution and Max Pool layers # * Apply a Flatten Layer # * Apply 1, 2, or 3 Fully Connected Layers # * Apply an Output Layer # * Return the output # * Apply [TensorFlow's Dropout](https://www.tensorflow.org/api_docs/python/tf/nn/dropout) to one or more layers in the model using `keep_prob`. # In[12]: