July 2018
Beginner to intermediate
312 pages
8h 31m
English
We will define the constructor for initializing the memory network's initializer object, optimizer object, mini-batch size, and so on. We will also write high-level TensorFlow operations for the loss, prediction, and training. All of them hinge on the _inference method, which we will implement in the following sections:
class MemoryNetwork(object): def __init__(self, sentence_size, vocab_size, candidates_size, candidates_vec, embedding_size, hops, initializer=tf.random_normal_initializer(stddev=0.1), optimizer=tf.train.AdamOptimizer(learning_rate=0.01), session=tf.Session()): self._hops = hops self._candidates_vec = candidates_vec # Define placeholders for inputs to the model self._facts = tf.placeholder( tf.int32, [None, ...
Read now
Unlock full access