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","]","#","}"]
code: def _make_processor(
      dataset_hparams, data_spec, chained=True, name_prefix=None
  ):
      # Create data decoder
      decoder = ScalarDataDecoder(
          ScalarData._get_dtype(dataset_hparams["data_type"]),
          data_name=name_prefix,
      )
      # Create other transformations
      data_spec.add_spec(decoder=decoder)
      # pylint: disable=protected-access
      other_trans = MonoTextData._make_other_transformations(
          dataset_hparams["other_transformations"], data_spec
      )
  
      data_spec.add_spec(name_prefix=name_prefix)
  
      if chained:
          chained_tran = dsutils.make_chained_transformation(
              [decoder] + other_trans
          )
          return chained_tran, data_spec
      else:
          return decoder, other_trans, data_spec
  
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 4 for calling the ScalarData obj's underlying member method code with example usage: obj._make_processor(dataset_hparams, data_spec, chained, name_prefix) and returns: chained_tran,  data_spec, decoder,  other_trans,  data_spec