def compute_bow_reconstruction_loss(hidden, word_emb, input_ids, input_mask,
                                    word_emb_size, vocab_size):
  """Creates loss for BOW reconstruction from hidden states.

  Args:
    hidden: (tf.float32) batch_size x dim1
    word_emb: (tf.float32) vocab_size x dim2
    input_ids: (tf.float32) batch_size x seq_length
    input_mask: (tf.int32) batch_size x seq_length
    word_emb_size: scalar
    vocab_size: scalar

  Returns:
    loss: (tf.float32) scalar
  """
  hidden = contrib_layers.fully_connected(
      hidden, word_emb_size, activation_fn=tf.nn.relu)
  input_onehot = _convert_ids_to_onehot(input_ids, input_mask, vocab_size)
  logits = tf.matmul(hidden, word_emb, transpose_b=True)
  bce_losses = tf.nn.sigmoid_cross_entropy_with_logits(
      labels=tf.cast(input_onehot, tf.float32), logits=logits)
  return tf.reduce_mean(bce_losses)
Creates loss for BOW reconstruction from hidden states.

  Args:
    hidden: (tf.float32) batch_size x dim1
    word_emb: (tf.float32) vocab_size x dim2
    input_ids: (tf.float32) batch_size x seq_length
    input_mask: (tf.int32) batch_size x seq_length
    word_emb_size: scalar
    vocab_size: scalar

  Returns:
    loss: (tf.float32) scalar
  
language/labs/drkit/run_dualencoder_lsf.py