class_docstr: Data consisting of multiple aligned parts.
  
  Args:
      hparams (dict): Hyperparameters. See :meth:`default_hparams` for the
          defaults.
  
  The processor can read any number of parallel fields as specified in
  the "datasets" list of :attr:`hparams`, and result in a TF Dataset whose
  element is a python `dict` containing data fields from each of the
  specified datasets. Fields from a text dataset or TFRecord dataset have
  names prefixed by its "data_name". Fields from a scalar dataset are
  specified by its "data_name".
  
  Example:
  
      .. code-block:: python
  
          hparams={
              'datasets': [
                  {'files': 'a.txt', 'vocab_file': 'v.a', 'data_name': 'x'},
                  {'files': 'b.txt', 'vocab_file': 'v.b', 'data_name': 'y'},
                  {'files': 'c.txt', 'data_type': 'int', 'data_name': 'z'}
              ]
              'batch_size': 1
          }
          data = MultiAlignedData(hparams)
          iterator = DataIterator(data)
          batch = iterator.get_next()
  
          iterator.switch_to_dataset(sess) # initializes the dataset
          batch_ = sess.run(batch)
          # batch_ == {
          #    'x_text': [['<BOS>', 'x', 'sequence', '<EOS>']],
          #    'x_text_ids': [['1', '5', '10', '2']],
          #    'x_length': [4]
          #    'y_text': [['<BOS>', 'y', 'sequence', '1', '<EOS>']],
          #    'y_text_ids': [['1', '6', '10', '20', '2']],
          #    'y_length': [5],
          #    'z': [1000],
          # }
          ...
  
          hparams={
              'datasets': [
                  {'files': 'd.txt', 'vocab_file': 'v.d', 'data_name': 'm'},
                  {
                      'files': 'd.tfrecord',
                      'data_type': 'tf_record',
                      "feature_original_types": {
                          'image': ['tf.string', 'FixedLenFeature']
                      },
                      'image_options': {
                          'image_feature_name': 'image',
                          'resize_height': 512,
                          'resize_width': 512,
                      },
                      'data_name': 't',
                  }
              ]
              'batch_size': 1
          }
          data = MultiAlignedData(hparams)
          iterator = DataIterator(data)
          batch = iterator.get_next()
  
          iterator.switch_to_dataset(sess) # initializes the dataset
          batch_ = sess.run(batch)
          # batch_ == {
          #    'x_text': [['<BOS>', 'NewYork', 'City', 'Map', '<EOS>']],
          #    'x_text_ids': [['1', '100', '80', '65', '2']],
          #    'x_length': [5],
          #
          #    # "t_image" is a list of a "numpy.ndarray" image
          #    # in this example. Its width equals to 512 and
          #    # its height equals to 512.
          #    't_image': [...]
          # }
class_docstr_tok: ["Data","consisting","of","multiple","aligned","parts",".","Args",":","hparams","(","dict",")",":","Hyperparameters",".","See",":","meth",":","`","default_hparams","`","for","the","defaults",".","The","processor","can","read","any","number","of","parallel","fields","as","specified","in","the","``","datasets","''","list","of",":","attr",":","`","hparams","`",",","and","result","in","a","TF","Dataset","whose","element","is","a","python","`","dict","`","containing","data","fields","from","each","of","the","specified","datasets",".","Fields","from","a","text","dataset","or","TFRecord","dataset","have","names","prefixed","by","its","``","data_name","''",".","Fields","from","a","scalar","dataset","are","specified","by","its","``","data_name","''",".","Example",":","..","code-block",":",":","python","hparams=","{","'datasets","'",":","[","{","'files","'",":","'","a.txt","'",",","'vocab_file","'",":","'","v.a","'",",","'data_name","'",":","'","x","'","}",",","{","'files","'",":","'","b.txt","'",",","'vocab_file","'",":","'","v.b","'",",","'data_name","'",":","'","y","'","}",",","{","'files","'",":","'","c.txt","'",",","'data_type","'",":","'int","'",",","'data_name","'",":","'","z","'","}","]","'batch_size","'",":","1","}","data","=","MultiAlignedData","(","hparams",")","iterator","=","DataIterator","(","data",")","batch","=","iterator.get_next","(",")","iterator.switch_to_dataset","(","sess",")","#","initializes","the","dataset","batch_","=","sess.run","(","batch",")","#","batch_","==","{","#","'x_text","'",":","[","[","'","<","BOS",">","'",",","'","x","'",",","'sequence","'",",","'","<","EOS",">","'","]","]",",","#","'x_text_ids","'",":","[","[","'","1","'",",","'","5","'",",","'10","'",",","'","2","'","]","]",",","#","'x_length","'",":","[","4","]","#","'y_text","'",":","[","[","'","<","BOS",">","'",",","'","y","'",",","'sequence","'",",","'","1","'",",","'","<","EOS",">","'","]","]",",","#","'y_text_ids","'",":","[","[","'","1","'",",","'","6","'",",","'10","'",",","'20","'",",","'","2","'","]","]",",","#","'y_length","'",":","[","5","]",",","#","'","z","'",":","[","1000","]",",","#","}","...","hparams=","{","'datasets","'",":","[","{","'files","'",":","'d.txt","'",",","'vocab_file","'",":","'","v.d","'",",","'data_name","'",":","'m","'","}",",","{","'files","'",":","'d.tfrecord","'",",","'data_type","'",":","'tf_record","'",",","``","feature_original_types","''",":","{","'image","'",":","[","'tf.string","'",",","'FixedLenFeature","'","]","}",",","'image_options","'",":","{","'image_feature_name","'",":","'image","'",",","'resize_height","'",":","512",",","'resize_width","'",":","512",",","}",",","'data_name","'",":","'t","'",",","}","]","'batch_size","'",":","1","}","data","=","MultiAlignedData","(","hparams",")","iterator","=","DataIterator","(","data",")","batch","=","iterator.get_next","(",")","iterator.switch_to_dataset","(","sess",")","#","initializes","the","dataset","batch_","=","sess.run","(","batch",")","#","batch_","==","{","#","'x_text","'",":","[","[","'","<","BOS",">","'",",","'NewYork","'",",","'City","'",",","'Map","'",",","'","<","EOS",">","'","]","]",",","#","'x_text_ids","'",":","[","[","'","1","'",",","'100","'",",","'80","'",",","'65","'",",","'","2","'","]","]",",","#","'x_length","'",":","[","5","]",",","#","#","#","``","t_image","''","is","a","list","of","a","``","numpy.ndarray","''","image","#","#","in","this","example",".","Its","width","equals","to","512","and","#","#","its","height","equals","to","512",".","#","'t_image","'",":","[","...","]","#","}"]
docstr: Returns a dicitionary of default hyperparameters.
  
  .. code-block:: python
  
      {
          # (1) Hyperparams specific to text dataset
          "datasets": []
          # (2) General hyperparams
          "num_epochs": 1,
          "batch_size": 64,
          "allow_smaller_final_batch": True,
          "shuffle": True,
          "shuffle_buffer_size": None,
          "shard_and_shuffle": False,
          "num_parallel_calls": 1,
          "prefetch_buffer_size": 0,
          "max_dataset_size": -1,
          "seed": None,
          "name": "multi_aligned_data",
      }
  
  Here:
  
  1. "datasets" is a list of `dict` each of which specifies a
  dataset which can be text, scalar or TFRecord. The
  :attr:`"data_name"` field of each dataset is used as the name
  prefix of the data fields from the respective dataset. The
  :attr:`"data_name"` field of each dataset should not be the same.
  
      - For scalar dataset, the allowed hyperparameters and default             values are the same as the "dataset" field of             :meth:`texar.tf.data.ScalarData.default_hparams`. Note that             :attr:`"data_type"` must be explicily specified             (either "int" or "float"). 
      - For TFRecord dataset, the allowed hyperparameters and default             values are the same as the "dataset" field of             :meth:`texar.tf.data.TFRecordData.default_hparams`. Note that             :attr:`"data_type"` must be explicily specified             (tf_record"). 
      - For text dataset, the allowed hyperparameters and default values            are the same as the "dataset" filed of             :meth:`texar.tf.data.MonoTextData.default_hparams`, with several             extra hyperparameters:
  
          "data_type": str
              The type of the dataset, one of {"text", "int", "float",
              "tf_record"}. If set to "int" or "float", the dataset is
              considered to be a scalar dataset. If set to "tf_record",
              the dataset is considered to be a TFRecord dataset.
              If not specified or set to "text", the dataset is
              considered to be a text dataset.
  
          "vocab_share_with": int, optional
              Share the vocabulary of a preceding text dataset with the
              specified index in the list (starting from 0). The
              specified dataset must be a text dataset, and must have
              an index smaller than the current dataset.
  
              If specified, the vocab file of current dataset is ignored.
              Default is `None` which disables the vocab sharing.
  
          "embedding_init_share_with": int, optional
              Share the embedding initial value of a preceding text
              dataset with the specified index in the list (starting
              from 0).
              The specified dataset must be a text dataset, and must have
              an index smaller than the current dataset.
  
              If specified, the :attr:`"embedding_init"` field of
              the current dataset is ignored. Default is `None` which
              disables the initial value sharing.
  
          "processing_share_with": int, optional
              Share the processing configurations of a preceding text
              dataset with the specified index in the list (starting
              from 0).
              The specified dataset must be a text dataset, and must have
              an index smaller than the current dataset.
  
              If specified, relevant field of the current dataset are
              ignored, including "delimiter", "bos_token", "eos_token",
              and "other_transformations". Default is `None` which
              disables the processing sharing.
  
  2. For the **general** hyperparameters, see
  :meth:`texar.tf.data.DataBase.default_hparams` for details.
docstr_tok: ["Returns","a","dicitionary","of","default","hyperparameters",".","..","code-block",":",":","python","{","#","(","1",")","Hyperparams","specific","to","text","dataset","``","datasets","''",":","[","]","#","(","2",")","General","hyperparams","``","num_epochs","''",":","1",",","``","batch_size","''",":","64",",","``","allow_smaller_final_batch","''",":","True",",","``","shuffle","''",":","True",",","``","shuffle_buffer_size","''",":","None",",","``","shard_and_shuffle","''",":","False",",","``","num_parallel_calls","''",":","1",",","``","prefetch_buffer_size","''",":","0",",","``","max_dataset_size","''",":","-1",",","``","seed","''",":","None",",","``","name","''",":","``","multi_aligned_data","''",",","}","Here",":","1",".","``","datasets","''","is","a","list","of","`","dict","`","each","of","which","specifies","a","dataset","which","can","be","text",",","scalar","or","TFRecord",".","The",":","attr",":","`","``","data_name","''","`","field","of","each","dataset","is","used","as","the","name","prefix","of","the","data","fields","from","the","respective","dataset",".","The",":","attr",":","`","``","data_name","''","`","field","of","each","dataset","should","not","be","the","same",".","-","For","scalar","dataset",",","the","allowed","hyperparameters","and","default","values","are","the","same","as","the","``","dataset","''","field","of",":","meth",":","`","texar.tf.data.ScalarData.default_hparams","`",".","Note","that",":","attr",":","`","``","data_type","''","`","must","be","explicily","specified","(","either","``","int","''","or","``","float","''",")",".","-","For","TFRecord","dataset",",","the","allowed","hyperparameters","and","default","values","are","the","same","as","the","``","dataset","''","field","of",":","meth",":","`","texar.tf.data.TFRecordData.default_hparams","`",".","Note","that",":","attr",":","`","``","data_type","''","`","must","be","explicily","specified","(","tf_record","''",")",".","-","For","text","dataset",",","the","allowed","hyperparameters","and","default","values","are","the","same","as","the","``","dataset","''","filed","of",":","meth",":","`","texar.tf.data.MonoTextData.default_hparams","`",",","with","several","extra","hyperparameters",":","``","data_type","''",":","str","The","type","of","the","dataset",",","one","of","{","``","text","''",",","``","int","''",",","``","float","''",",","``","tf_record","''","}",".","If","set","to","``","int","''","or","``","float","''",",","the","dataset","is","considered","to","be","a","scalar","dataset",".","If","set","to","``","tf_record","''",",","the","dataset","is","considered","to","be","a","TFRecord","dataset",".","If","not","specified","or","set","to","``","text","''",",","the","dataset","is","considered","to","be","a","text","dataset",".","``","vocab_share_with","''",":","int",",","optional","Share","the","vocabulary","of","a","preceding","text","dataset","with","the","specified","index","in","the","list","(","starting","from","0",")",".","The","specified","dataset","must","be","a","text","dataset",",","and","must","have","an","index","smaller","than","the","current","dataset",".","If","specified",",","the","vocab","file","of","current","dataset","is","ignored",".","Default","is","`","None","`","which","disables","the","vocab","sharing",".","``","embedding_init_share_with","''",":","int",",","optional","Share","the","embedding","initial","value","of","a","preceding","text","dataset","with","the","specified","index","in","the","list","(","starting","from","0",")",".","The","specified","dataset","must","be","a","text","dataset",",","and","must","have","an","index","smaller","than","the","current","dataset",".","If","specified",",","the",":","attr",":","`","``","embedding_init","''","`","field","of","the","current","dataset","is","ignored",".","Default","is","`","None","`","which","disables","the","initial","value","sharing",".","``","processing_share_with","''",":","int",",","optional","Share","the","processing","configurations","of","a","preceding","text","dataset","with","the","specified","index","in","the","list","(","starting","from","0",")",".","The","specified","dataset","must","be","a","text","dataset",",","and","must","have","an","index","smaller","than","the","current","dataset",".","If","specified",",","relevant","field","of","the","current","dataset","are","ignored",",","including","``","delimiter","''",",","``","bos_token","''",",","``","eos_token","''",",","and","``","other_transformations","''",".","Default","is","`","None","`","which","disables","the","processing","sharing",".","2",".","For","the","*","*","general","*","*","hyperparameters",",","see",":","meth",":","`","texar.tf.data.DataBase.default_hparams","`","for","details","."]
code: def default_hparams():
      """Returns a dicitionary of default hyperparameters.
  
          .. code-block:: python
  
              {
                  # (1) Hyperparams specific to text dataset
                  "datasets": []
                  # (2) General hyperparams
                  "num_epochs": 1,
                  "batch_size": 64,
                  "allow_smaller_final_batch": True,
                  "shuffle": True,
                  "shuffle_buffer_size": None,
                  "shard_and_shuffle": False,
                  "num_parallel_calls": 1,
                  "prefetch_buffer_size": 0,
                  "max_dataset_size": -1,
                  "seed": None,
                  "name": "multi_aligned_data",
              }
  
          Here:
  
          1. "datasets" is a list of `dict` each of which specifies a
          dataset which can be text, scalar or TFRecord. The
          :attr:`"data_name"` field of each dataset is used as the name
          prefix of the data fields from the respective dataset. The
          :attr:`"data_name"` field of each dataset should not be the same.
  
              - For scalar dataset, the allowed hyperparameters and default \
              values are the same as the "dataset" field of \
              :meth:`texar.tf.data.ScalarData.default_hparams`. Note that \
              :attr:`"data_type"` must be explicily specified \
              (either "int" or "float"). \
  
              - For TFRecord dataset, the allowed hyperparameters and default \
              values are the same as the "dataset" field of \
              :meth:`texar.tf.data.TFRecordData.default_hparams`. Note that \
              :attr:`"data_type"` must be explicily specified \
              (tf_record"). \
  
              - For text dataset, the allowed hyperparameters and default values\
              are the same as the "dataset" filed of \
              :meth:`texar.tf.data.MonoTextData.default_hparams`, with several \
              extra hyperparameters:
  
                  "data_type": str
                      The type of the dataset, one of {"text", "int", "float",
                      "tf_record"}. If set to "int" or "float", the dataset is
                      considered to be a scalar dataset. If set to "tf_record",
                      the dataset is considered to be a TFRecord dataset.
                      If not specified or set to "text", the dataset is
                      considered to be a text dataset.
  
                  "vocab_share_with": int, optional
                      Share the vocabulary of a preceding text dataset with the
                      specified index in the list (starting from 0). The
                      specified dataset must be a text dataset, and must have
                      an index smaller than the current dataset.
  
                      If specified, the vocab file of current dataset is ignored.
                      Default is `None` which disables the vocab sharing.
  
                  "embedding_init_share_with": int, optional
                      Share the embedding initial value of a preceding text
                      dataset with the specified index in the list (starting
                      from 0).
                      The specified dataset must be a text dataset, and must have
                      an index smaller than the current dataset.
  
                      If specified, the :attr:`"embedding_init"` field of
                      the current dataset is ignored. Default is `None` which
                      disables the initial value sharing.
  
                  "processing_share_with": int, optional
                      Share the processing configurations of a preceding text
                      dataset with the specified index in the list (starting
                      from 0).
                      The specified dataset must be a text dataset, and must have
                      an index smaller than the current dataset.
  
                      If specified, relevant field of the current dataset are
                      ignored, including "delimiter", "bos_token", "eos_token",
                      and "other_transformations". Default is `None` which
                      disables the processing sharing.
  
          2. For the **general** hyperparameters, see
          :meth:`texar.tf.data.DataBase.default_hparams` for details.
          """
      hparams = TextDataBase.default_hparams()
      hparams["name"] = "multi_aligned_data"
      hparams["datasets"] = []
      return hparams
  
imports: import copy
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils import utils
  from texar.tf.utils.dtypes import is_str, is_callable
  from texar.tf.data.data.text_data_base import TextDataBase
  from texar.tf.data.data.scalar_data import ScalarData
  from texar.tf.data.data.tfrecord_data import TFRecordData
  from texar.tf.data.data.mono_text_data import _default_mono_text_dataset_hparams
  from texar.tf.data.data.scalar_data import _default_scalar_dataset_hparams
  from texar.tf.data.data.tfrecord_data import _default_tfrecord_dataset_hparams
  from texar.tf.data.data.mono_text_data import MonoTextData
  from texar.tf.data.data_utils import count_file_lines
  from texar.tf.data.data import dataset_utils
  from texar.tf.data.vocabulary import Vocab, SpecialTokens
  from texar.tf.data.embedding import Embedding
label_desc: Use image node_id 2 for calling the MultiAlignedData obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams