class_docstr: Given a sequence of even length, embed pairs of adjacent elements.
  Input is (batchsize, max_seqlength)
  seqlength should be even
  Output is (batchsize, 0.5*max_seqlength, emb_dim)
  
  This will embed all even and all odd elements of the sequence separately,
  concatenate the even embedding with the odd embeddings and then project the
  result to emb_dim.
  This is useful to project a sequence of [(rel, ent), ...] into a sequence
  of vectors for each (rel, ent) pair.
class_docstr_tok: ["Given","a","sequence","of","even","length",",","embed","pairs","of","adjacent","elements",".","Input","is","(","batchsize",",","max_seqlength",")","seqlength","should","be","even","Output","is","(","batchsize",",","0.5","*","max_seqlength",",","emb_dim",")","This","will","embed","all","even","and","all","odd","elements","of","the","sequence","separately",",","concatenate","the","even","embedding","with","the","odd","embeddings","and","then","project","the","result","to","emb_dim",".","This","is","useful","to","project","a","sequence","of","[","(","rel",",","ent",")",",","...","]","into","a","sequence","of","vectors","for","each","(","rel",",","ent",")","pair","."]
docstr: Embed the input.
docstr_tok: ["Embed","the","input","."]
code: def embed(self, inputs):
      """Embed the input."""
      seq_embed_a = self._lookup(self.embeddings_a, inputs[:, 0::2])
      seq_embed_b = self._lookup(self.embeddings_b, inputs[:, 1::2])
      seq_embeddings = tf.concat([seq_embed_a, seq_embed_b], axis=-1)
      seq_embeddings_flat = tf.reshape(
          seq_embeddings, (-1, 2 * self.emb_dim)
      )
      final_embeddings_flat = tf.matmul(
          seq_embeddings_flat, self.proj_w
      )
      final_embeddings = tf.reshape(
          final_embeddings_flat,
          tf.concat([tf.shape(seq_embeddings)[:2], [self.emb_dim]], 0),
      )
      output = tf.cond(
          self.is_train,
          lambda: tf.nn.dropout(
              final_embeddings, self.dropout, name="dropout"
          ),
          lambda: final_embeddings,
      )
      return output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  import utils
label_desc: Use image node_id 3 for calling the EmbedAlternateSeq obj's underlying member method code with example usage: obj.embed(inputs) and returns: output