class_docstr: Task class for text sequence to sequence.
class_docstr_tok: ["Task","class","for","text","sequence","to","sequence","."]
docstr: Data set function
docstr_tok: ["Data","set","function"]
code: def dataset(self):
      """Data set function"""
  
      data_set = self.generate_data()
      logging.debug("data_set: {}".format(data_set))
      if self.need_shuffle and self.mode == "train":
          # shuffle batch size and repeat
          logging.debug("shuffle dataset ...")
          data_set = data_set.apply(
              tf.data.experimental.shuffle_and_repeat(
                  buffer_size=self.shuffle_buffer_size, count=None
              )
          )
  
      feature_shape = self.feature_spec()
      logging.debug("feature_shape: {}".format(feature_shape))
      data_set = data_set.padded_batch(
          batch_size=self.batch_size, padded_shapes=feature_shape
      )
  
      data_set = data_set.prefetch(self.num_prefetch_batch)
  
      iterator = tf.data.make_initializable_iterator(data_set)
  
      # pylint: disable=unused-variable
      if self.infer_without_label:
          input_enc_x, input_enc_x_len = iterator.get_next()
          input_x_dict = collections.OrderedDict(
              [("input_enc_x", input_enc_x)]
          )
  
      else:
          (
              input_enc_x,
              input_enc_x_len,
              input_dec_x,
              input_dec_x_len,
          ), input_y = iterator.get_next()
  
          input_x_dict = collections.OrderedDict(
              [
                  ("input_enc_x", input_enc_x),
                  ("input_dec_x", input_dec_x),
              ]
          )
  
      return_dict = {
          "input_x_dict": input_x_dict,
          "input_x_len": input_enc_x_len,
          "iterator": iterator,
      }
  
      if not self.infer_without_label:
          return_dict["input_y_dict"] = collections.OrderedDict(
              [("input_y", input_y)]
          )
          return_dict["input_y_len"] = input_dec_x_len
  
      return return_dict
  
imports: import collections
  import os
  import delta.compat
  from absl import logging
  from delta import utils
  from delta.data.preprocess.text_ops import tokenize_sentence
  from delta.data.preprocess.utils import load_vocab_dict
  from delta.data.task.base_text_task import TextTask
  from delta.data.preprocess.text_ops import load_textline_dataset
  from delta.data.utils.common_utils import get_file_len
  from delta.layers.utils import compute_sen_lens
  from delta.utils.register import registers
label_desc: Use image node_id 8 for calling the TextS2STask obj's underlying member method code with example usage: obj.dataset() and returns: return_dict