'Build the graph for the forward pass.'

def forward(self, examples, labels):

    opts = self._options
    init_width = (0.5 / opts.emb_dim)
    emb = tf.Variable(tf.random_uniform([opts.vocab_size, opts.emb_dim], (- init_width), init_width), name='emb')
    self._emb = emb
    sm_w_t = tf.Variable(tf.zeros([opts.vocab_size, opts.emb_dim]), name='sm_w_t')
    sm_b = tf.Variable(tf.zeros([opts.vocab_size]), name='sm_b')
    self.global_step = tf.Variable(0, name='global_step')
    labels_matrix = tf.reshape(tf.cast(labels, dtype=tf.int64), [opts.batch_size, 1])
    (sampled_ids, _, _) = tf.nn.fixed_unigram_candidate_sampler(true_classes=labels_matrix, num_true=1, num_sampled=opts.num_samples, unique=True, range_max=opts.vocab_size, distortion=0.75, unigrams=opts.vocab_counts.tolist())
    example_emb = tf.nn.embedding_lookup(emb, examples)
    true_w = tf.nn.embedding_lookup(sm_w_t, labels)
    true_b = tf.nn.embedding_lookup(sm_b, labels)
    sampled_w = tf.nn.embedding_lookup(sm_w_t, sampled_ids)
    sampled_b = tf.nn.embedding_lookup(sm_b, sampled_ids)
    true_logits = (tf.reduce_sum(tf.multiply(example_emb, true_w), 1) + true_b)
    sampled_b_vec = tf.reshape(sampled_b, [opts.num_samples])
    sampled_logits = (tf.matmul(example_emb, sampled_w, transpose_b=True) + sampled_b_vec)
    return (true_logits, sampled_logits)
