Slide 32
Slide 32 text
W1 = tf.Variable(tf.truncated_normal([6, 24], stddev=0.1), name="weight1")
b1 = tf.Variable(tf.constant(0.1, shape=[24]), name="bias1")
h1 = leaky_relu(tf.matmul(x, W1) + b1)
W2 = tf.Variable(tf.truncated_normal([24, 96], stddev=0.1), name="weight2")
b2 = tf.Variable(tf.constant(0.1, shape=[96]), name="bias2")
h2 = leaky_relu(tf.matmul(h1, W2) + b2)
W3 = tf.Variable(tf.truncated_normal([96, 3], stddev=0.1), name="weight3")
b3 = tf.Variable(tf.constant(0.1, shape=[3]), name="bias3")
u = tf.nn.softmax(tf.matmul(h2, W3) + b3)
cross_entropy = -tf.reduce_sum(y * tf.log(u))
train_step = tf.train.GradientDescentOptimizer(0.01).minimize(loss)
r = npr.randint(len(ix))
feed = {x: ix[r].reshape((1,6)), y: iy[r].reshape((1,3))}
sess.run(train, feed_dict=feed)
Deep Learning コード抜粋(python)