'Compute classification loss from embedding.
Args:
embedded: Length 2 tuple of 3-D float Tensor
[batch_size, num_timesteps, embedding_dim].
inputs: Length 2 tuple of VatxtInput, defaults to self.cl_inputs.
return_intermediates: bool, whether to return intermediate tensors or only
the final loss.
Returns:
If return_intermediates is True:
lstm_out, next_states, logits, loss
Else:
loss'

def cl_loss_from_embedding(self, embedded, inputs=None, return_intermediates=False):

    if (inputs is None):
        inputs = self.cl_inputs
    out = []
    for (layer_name, emb, inp) in zip(['lstm', 'lstm_reverse'], embedded, inputs):
        out.append(self.layers[layer_name](emb, inp.state, inp.length))
    (lstm_outs, next_states) = zip(*out)
    lstm_out = tf.concat(lstm_outs, 1)
    logits = self.layers['cl_logits'](lstm_out)
    (f_inputs, _) = inputs
    loss = layers_lib.classification_loss(logits, f_inputs.labels, f_inputs.weights)
    if return_intermediates:
        return (lstm_out, next_states, logits, loss)
    else:
        return loss
