Skip to content

Instantly share code, notes, and snippets.

View Myeongjoon's full-sized avatar
🎯
Focusing

Joon Myeongjoon

🎯
Focusing
View GitHub Profile
@Myeongjoon
Myeongjoon / AdAccount.cs
Created December 24, 2018 01:13
ExampleValueObject
public class AdAccount : ValueObject
{
private AdAccount()
{
}
public static AdAccount For(string accountString)
{
var account = new AdAccount();
rnn_cell = tf.contrib.rnn.BasicRNNCell(hidden_layer_size)
outputs, _ = tf.nn.dynamic_rnn(rnn_cell, _inputs, dtype=tf.float32)
@Myeongjoon
Myeongjoon / rnn_minist_04_train_and_test.py
Created August 9, 2018 23:23
RNN train, test 스텝
# Merge all the summaries
merged = tf.summary.merge_all()
# Get a small test set
test_data = mnist.test.images[:batch_size].reshape((-1, time_steps, element_size))
test_label = mnist.test.labels[:batch_size]
with tf.Session() as sess:
# Write summaries to LOG_DIR -- used by TensorBoard
train_writer = tf.summary.FileWriter(LOG_DIR + '/train',
@Myeongjoon
Myeongjoon / rnn_minist_03_outputs.py
Created August 9, 2018 23:21
RNN output 스텝
# Weights for output layers
with tf.name_scope('linear_layer_weights') as scope:
with tf.name_scope("W_linear"):
Wl = tf.Variable(tf.truncated_normal([hidden_layer_size, num_classes],
mean=0, stddev=.01))
variable_summaries(Wl)
with tf.name_scope("Bias_linear"):
bl = tf.Variable(tf.truncated_normal([num_classes],
mean=0, stddev=.01))
variable_summaries(bl)
# Weights and bias for input and hidden layer
with tf.name_scope('rnn_weights'):
with tf.name_scope("W_x"):
Wx = tf.Variable(tf.zeros([element_size, hidden_layer_size]))
variable_summaries(Wx)
with tf.name_scope("W_h"):
Wh = tf.Variable(tf.zeros([hidden_layer_size, hidden_layer_size]))
variable_summaries(Wh)
with tf.name_scope("Bias"):
b_rnn = tf.Variable(tf.zeros([hidden_layer_size]))
from __future__ import print_function
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
element_size = 28
time_steps = 28
num_classes = 10
batch_size = 128