def call_next(self, inputs, inputs_length, previous_encoder_states):
        """
        Recognize function for encoder network from the previous encoder states

        Parameters
        ----------
        inputs : tf.Tensor, shape [B, T, E]
        previous_encoder_states : tf.Tensor, shape [nstates, B, rnn_units]

        Returns
        -------
        Tuple[tf.Tensor, tf.Tensor, tf.Tensor], shapes ([B, T, dmodel], [B], [nstates, B, rnn_units])
        """
        with tf.name_scope(f"{self.name}_call_next"):
            outputs, outputs_length = inputs, inputs_length
            if self._reduction_position == "pre":
                if self.reduction is not None:
                    outputs, outputs_length = self.reduction([outputs, outputs_length])
            outputs, *_states = self.rnn(
                outputs,
                training=False,
                initial_state=tf.unstack(previous_encoder_states, axis=0),
                mask=backend.get_keras_mask(inputs),
            )
            new_states = tf.stack(_states, axis=0)
            if self.ln is not None:
                outputs = self.ln(outputs, training=False)
            outputs = self.projection(outputs, training=False)
            if self._reduction_position == "post":
                if self.reduction is not None:
                    outputs, outputs_length = self.reduction([outputs, outputs_length])
            return outputs, outputs_length, new_states

        Recognize function for encoder network from the previous encoder states

        Parameters
        ----------
        inputs : tf.Tensor, shape [B, T, E]
        previous_encoder_states : tf.Tensor, shape [nstates, B, rnn_units]

        Returns
        -------
        Tuple[tf.Tensor, tf.Tensor, tf.Tensor], shapes ([B, T, dmodel], [B], [nstates, B, rnn_units])
        
tensorflow_asr/models/encoders/rnnt.py