Skip to content

Instantly share code, notes, and snippets.

@dhruvramani
Created August 3, 2017 18:26
Show Gist options
  • Save dhruvramani/711a7904e33388f424573c6f257344f7 to your computer and use it in GitHub Desktop.
Save dhruvramani/711a7904e33388f424573c6f257344f7 to your computer and use it in GitHub Desktop.
def __init__(self, config):
self.n_steps = self.config.hyperparams
self.n_input, self.n_hidden = 4, 20
self.lstm = tf.contrib.rnn.BasicLSTMCell(self.n_hidden, forget_bias=1.0, state_is_tuple=False)
def neural_search(self):
state = tf.Variable(tf.zeros(shape=[4]))
inp = tf.Variable(tf.random_normal(shape=[4]))
output = list()
for _ in range(self.n_steps):
inp, state = self.lstm(inp, state)
inp = tf.nn.softmax(tf.matmul(inp, self.Wc) + self.bc)
output.append(inp)
out = [utils.max(output[0]), utils.max(output[1]), utils.max(output[2]), utils.max(output[3]), utils.max(output[4]), utils.max(output[5])]
return out, output[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment