keras/src/layers/preprocessing/text_vectorization.py/TextVectorization/call
class TextVectorization:    def call(self, inputs):
        if not isinstance(
            inputs, (tf.Tensor, tf.RaggedTensor, np.ndarray, list, tuple)
        ):
            inputs = tf.convert_to_tensor(backend.convert_to_numpy(inputs))

        inputs = self._preprocess(inputs)

        # If we're not doing any output processing, return right away.
        if self._output_mode is None:
            outputs = inputs

        lookup_data = self._lookup_layer.call(inputs)

        # For non-int output, we can return directly from the underlying layer.
        if self._output_mode != "int":
            return backend_utils.convert_tf_tensor(lookup_data)

        # If we have a ragged tensor, we can pad during the conversion to dense.
        if isinstance(lookup_data, tf.RaggedTensor) and not self._ragged:
            shape = lookup_data.shape.as_list()
            # If output sequence length is None, to_tensor will pad the last
            # dimension to the bounding shape of the ragged dimension.
            shape[-1] = self._output_sequence_length
            outputs = lookup_data.to_tensor(default_value=0, shape=shape)
        else:
            outputs = lookup_data

        # If we have a dense tensor, we need to pad/trim directly.
        if self._output_sequence_length is not None:
            # Maybe trim the output.
            outputs = outputs[..., : self._output_sequence_length]

            # Maybe pad the output. We need to be careful to use dynamic shape
            # here as required_space_to_batch_paddings requires a fully known
            # shape.
            if not self._ragged:
                shape = tf.shape(outputs)
                padded_shape = tf.concat(
                    (shape[:-1], [self._output_sequence_length]), 0
                )
                padding, _ = tf.required_space_to_batch_paddings(
                    shape, padded_shape
                )
                outputs = tf.pad(outputs, padding)

        return backend_utils.convert_tf_tensor(outputs)