Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/3_NeuralNetworks/neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def neural_net(x_dict):
# TF Estimator input is a dict, in case of multiple inputs
x = x_dict['images']
# Hidden fully connected layer with 256 neurons
layer_1 = tf.layers.dense(x, n_hidden_1)
layer_1 = tf.nn.relu(tf.layers.dense(x, n_hidden_1)
# Hidden fully connected layer with 256 neurons
layer_2 = tf.layers.dense(layer_1, n_hidden_2)
layer_2 = tf.nn.relu(tf.layers.dense(layer_1, n_hidden_2))
# Output fully connected layer with a neuron for each class
out_layer = tf.layers.dense(layer_2, num_classes)
return out_layer
Expand Down
6 changes: 3 additions & 3 deletions examples/3_NeuralNetworks/neural_network_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import tensorflow as tf

# Parameters
learning_rate = 0.1
learning_rate = 0.01
num_steps = 500
batch_size = 128
display_step = 100
Expand Down Expand Up @@ -51,9 +51,9 @@
# Create model
def neural_net(x):
# Hidden fully connected layer with 256 neurons
layer_1 = tf.add(tf.matmul(x, weights['h1']), biases['b1'])
layer_1 = tf.nn.relu(tf.add(tf.matmul(x, weights['h1']), biases['b1']))
# Hidden fully connected layer with 256 neurons
layer_2 = tf.add(tf.matmul(layer_1, weights['h2']), biases['b2'])
layer_2 = tf.nn.relu(tf.add(tf.matmul(layer_1, weights['h2']), biases['b2']))
# Output fully connected layer with a neuron for each class
out_layer = tf.matmul(layer_2, weights['out']) + biases['out']
return out_layer
Expand Down