def _time_step(time, output_ta_t, state, att_scores=None):

        """Take a time step of the dynamic RNN.



        Args:

          time: int32 scalar Tensor.

          output_ta_t: List of `TensorArray`s that represent the output.

          state: nested tuple of vector tensors that represent the state.



        Returns:

          The tuple (time + 1, output_ta_t with updated flow, new_state).

        """

        input_t = tuple(ta.read(time) for ta in input_ta)

        # Restore some shape information

        for input_, shape in zip(input_t, inputs_got_shape):
            input_.set_shape(shape[1:])

        input_t = nest.pack_sequence_as(structure=inputs, flat_sequence=input_t)

        if att_scores is not None:

            att_score = att_scores[:, time, :]

            call_cell = lambda: cell(input_t, state, att_score)

        else:

            call_cell = lambda: cell(input_t, state)

        if sequence_length is not None:

            (output, new_state) = _rnn_step(

                time=time,

                sequence_length=sequence_length,

                min_sequence_length=min_sequence_length,

                max_sequence_length=max_sequence_length,

                zero_output=zero_output,

                state=state,

                call_cell=call_cell,

                state_size=state_size,

                skip_conditionals=True)

        else:

            (output, new_state) = call_cell()

        # Pack state if using state tuples

        output = nest.flatten(output)

        output_ta_t = tuple(

            ta.write(time, out) for ta, out in zip(output_ta_t, output))

        if att_scores is not None:

            return (time + 1, output_ta_t, new_state, att_scores)

        else:

            return (time + 1, output_ta_t, new_state)
Take a time step of the dynamic RNN.



        Args:

          time: int32 scalar Tensor.

          output_ta_t: List of `TensorArray`s that represent the output.

          state: nested tuple of vector tensors that represent the state.



        Returns:

          The tuple (time + 1, output_ta_t with updated flow, new_state).

        
deepctr/contrib/rnn_v2.py