Dynamic unroll across input objects.

    Args:
      inputs: tensor (input_sequence_length x batch x feature_size). Encoder
          sequence.
      targets: tensor (output_sequence_length x batch x feature_size). Decoder
          sequence.
      input_sequence_length: tensor (batch). Size of each batched input
          sequence.
      output_sequence_length: tensor (batch). Size of each batched target
          sequence.

    Returns:
      Tensor (batch x num_objects); logits indicating the reference objects.

def _build(
      self, inputs, targets, input_sequence_length, output_sequence_length):
    """Dynamic unroll across input objects.

    Args:
      inputs: tensor (input_sequence_length x batch x feature_size). Encoder
          sequence.
      targets: tensor (output_sequence_length x batch x feature_size). Decoder
          sequence.
      input_sequence_length: tensor (batch). Size of each batched input
          sequence.
      output_sequence_length: tensor (batch). Size of each batched target
          sequence.

    Returns:
      Tensor (batch x num_objects); logits indicating the reference objects.
    """
    # Connect decoding steps.
    batch_size = inputs.get_shape()[1]
    initial_state = self._core.initial_state(batch_size, trainable=False)
    _, state = tf.nn.dynamic_rnn(
        cell=self._core,
        inputs=inputs,
        sequence_length=input_sequence_length,
        time_major=True,
        initial_state=initial_state
    )
    # Connect decoding steps.
    zero_input = tf.zeros(shape=targets.get_shape())
    output_sequence, _ = tf.nn.dynamic_rnn(
        cell=self._core,
        inputs=zero_input,  # Non-autoregressive model.  Zeroed input.
        sequence_length=output_sequence_length,
        initial_state=state,
        time_major=True)
    outputs = snt.BatchApply(self._final_mlp)(output_sequence)
    logits = snt.BatchApply(snt.Linear(self._target_size))(outputs)
    tf.logging.info("Connected seq2seq model.")
    return logits