'Returns embedding for global condition.
:param global_condition: Either ID of global condition for
tf.nn.embedding_lookup or actual embedding. The latter is
experimental.
:return: Embedding or None'

def _embed_gc(self, global_condition):

    embedding = None
    if (self.global_condition_cardinality is not None):
        embedding_table = self.variables['embeddings']['gc_embedding']
        embedding = tf.nn.embedding_lookup(embedding_table, global_condition)
    elif (global_condition is not None):
        gc_batch_rank = len(global_condition.get_shape())
        dims_match = (global_condition.get_shape()[(gc_batch_rank - 1)] == self.global_condition_channels)
        if (not dims_match):
            raise ValueError('Shape    of    global_condition    {}    does    not    match    global_condition_channels    {}.'.format(global_condition.get_shape(), self.global_condition_channels))
        embedding = global_condition
    if (embedding is not None):
        embedding = tf.reshape(embedding, [self.batch_size, 1, self.global_condition_channels])
    return embedding
