import tensorflow as tf

      log_r *= tf.to_float(t < self.seq_lengths - 1)
      weights += log_r - prev_log_r
    new_state = TrainableVRNNState(rnn_state=next_rnn_state,
                                   rnn_out=rnn_out,
                                   latent_encoded=latent_encoded)
    return weights, new_state


_DEFAULT_INITIALIZERS = {"w": tf.contrib.layers.xavier_initializer(),
                         "b": tf.zeros_initializer()}


def create_vrnn(
    data_size,
    latent_size,
    emission_class,
    rnn_hidden_size=None,
    fcnet_hidden_sizes=None,
