class_docstr: Scalar data where each line of the files is a scalar (int or float),
  e.g., a data label.
  
  Args:
      hparams (dict): Hyperparameters. See :meth:`default_hparams` for the
          defaults.
  
  The processor reads and processes raw data and results in a TF dataset
  whose element is a python `dict` including one field. The field name is
  specified in :attr:`hparams["dataset"]["data_name"]`. If not specified,
  the default name is `"data"`. The field name can be accessed through
  :attr:`data_name`.
  
  This field is a Tensor of shape `[batch_size]` containing a batch of
  scalars, of either int or float type as specified in :attr:`hparams`.
  
  Example:
  
      .. code-block:: python
  
          hparams={
              'dataset': { 'files': 'data.txt', 'data_name': 'label' },
              'batch_size': 2
          }
          data = ScalarData(hparams)
          iterator = DataIterator(data)
          batch = iterator.get_next()
  
          iterator.switch_to_dataset(sess) # initializes the dataset
          batch_ = sess.run(batch)
          # batch_ == {
          #     'label': [2, 9]
          # }
class_docstr_tok: ["Scalar","data","where","each","line","of","the","files","is","a","scalar","(","int","or","float",")",",","e.g.",",","a","data","label",".","Args",":","hparams","(","dict",")",":","Hyperparameters",".","See",":","meth",":","`","default_hparams","`","for","the","defaults",".","The","processor","reads","and","processes","raw","data","and","results","in","a","TF","dataset","whose","element","is","a","python","`","dict","`","including","one","field",".","The","field","name","is","specified","in",":","attr",":","`","hparams","[","``","dataset","''","]","[","``","data_name","''","]","`",".","If","not","specified",",","the","default","name","is","`","``","data","''","`",".","The","field","name","can","be","accessed","through",":","attr",":","`","data_name","`",".","This","field","is","a","Tensor","of","shape","`","[","batch_size","]","`","containing","a","batch","of","scalars",",","of","either","int","or","float","type","as","specified","in",":","attr",":","`","hparams","`",".","Example",":","..","code-block",":",":","python","hparams=","{","'dataset","'",":","{","'files","'",":","'data.txt","'",",","'data_name","'",":","'label","'","}",",","'batch_size","'",":","2","}","data","=","ScalarData","(","hparams",")","iterator","=","DataIterator","(","data",")","batch","=","iterator.get_next","(",")","iterator.switch_to_dataset","(","sess",")","#","initializes","the","dataset","batch_","=","sess.run","(","batch",")","#","batch_","==","{","#","'label","'",":","[","2",",","9","]","#","}"]
docstr: Returns a dicitionary of default hyperparameters.
  
  .. code-block:: python
  
      {
          # (1) Hyperparams specific to scalar dataset
          "dataset": {
              "files": [],
              "compression_type": None,
              "data_type": "int",
              "other_transformations": [],
              "data_name": None,
          }
          # (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": "scalar_data",
      }
  
  Here:
  
  1. For the hyperparameters in the :attr:`"dataset"` field:
  
      "files": str or list
          A (list of) file path(s).
  
          Each line contains a single scalar number.
  
      "compression_type": str, optional
          One of "" (no compression), "ZLIB", or "GZIP".
  
      "data_type": str
          The scalar type. Currently supports "int" and "float".
  
      "other_transformations": list
          A list of transformation functions or function names/paths to
          further transform each single data instance.
  
          (More documentations to be added.)
  
      "data_name": str
          Name of the dataset.
  
  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","scalar","dataset","``","dataset","''",":","{","``","files","''",":","[","]",",","``","compression_type","''",":","None",",","``","data_type","''",":","``","int","''",",","``","other_transformations","''",":","[","]",",","``","data_name","''",":","None",",","}","#","(","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","''",":","``","scalar_data","''",",","}","Here",":","1",".","For","the","hyperparameters","in","the",":","attr",":","`","``","dataset","''","`","field",":","``","files","''",":","str","or","list","A","(","list","of",")","file","path","(","s",")",".","Each","line","contains","a","single","scalar","number",".","``","compression_type","''",":","str",",","optional","One","of","``","''","(","no","compression",")",",","``","ZLIB","''",",","or","``","GZIP","''",".","``","data_type","''",":","str","The","scalar","type",".","Currently","supports","``","int","''","and","``","float","''",".","``","other_transformations","''",":","list","A","list","of","transformation","functions","or","function","names\/paths","to","further","transform","each","single","data","instance",".","(","More","documentations","to","be","added",".",")","``","data_name","''",":","str","Name","of","the","dataset",".","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 scalar dataset
              "dataset": {
                  "files": [],
                  "compression_type": None,
                  "data_type": "int",
                  "other_transformations": [],
                  "data_name": None,
              }
              # (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": "scalar_data",
          }
  
      Here:
  
      1. For the hyperparameters in the :attr:`"dataset"` field:
  
          "files": str or list
              A (list of) file path(s).
  
              Each line contains a single scalar number.
  
          "compression_type": str, optional
              One of "" (no compression), "ZLIB", or "GZIP".
  
          "data_type": str
              The scalar type. Currently supports "int" and "float".
  
          "other_transformations": list
              A list of transformation functions or function names/paths to
              further transform each single data instance.
  
              (More documentations to be added.)
  
          "data_name": str
              Name of the dataset.
  
      2. For the **general** hyperparameters, see
      :meth:`texar.tf.data.DataBase.default_hparams` for details.
  
      """
      hparams = DataBase.default_hparams()
      hparams["name"] = "scalar_data"
      hparams.update({"dataset": _default_scalar_dataset_hparams()})
      return hparams
  
file_path: texar/texar/tf/data/data/scalar_data.py
imports: import tensorflow
  from texar.tf.data.data_utils import count_file_lines
  from texar.tf.data.data import dataset_utils
  from texar.tf.data.data.data_base import DataBase
  from texar.tf.data.data.mono_text_data import MonoTextData
  from texar.tf.data.data_decoders import ScalarDataDecoder
label_desc: Use image node_id 2 for calling the ScalarData obj's underlying member method code with example usage: obj.default_hparams() and returns: hparams