original_docstring:  Cache TensorBoard logs for the given session ID on first access.
  
          Populates :attr:`_cache` with timestamps and loss data.
  
          If this is a training session and the data is being queried for the training session ID
          then get the latest available data and append to the cache
  
          Parameters
          -------
          session_id: int
              The session ID to cache the data for
          is_training: bool, optional
              ``True`` if a current training session is running otherwise ``False``.
              Default: ``False``
          
docstring: Cache TensorBoard logs for the given session ID on first access.
  Populates :attr:`_cache` with timestamps and loss data.
  
  If this is a training session and the data is being queried for the training session ID
  then get the latest available data and append to the cache
  
  Parameters
  
  
docstring_tokens: Cache TensorBoard logs for the given session ID on first access . Populates : attr : ` _cache ` with timestamps and loss data . If this is a training session and the data is being queried for the training session ID then get the latest available data and append to the cache Parameters
code: def _cache_data(self, session_id, is_training=False):
          """ Cache TensorBoard logs for the given session ID on first access.
  
          Populates :attr:`_cache` with timestamps and loss data.
  
          If this is a training session and the data is being queried for the training session ID
          then get the latest available data and append to the cache
  
          Parameters
          -------
          session_id: int
              The session ID to cache the data for
          is_training: bool, optional
              ``True`` if a current training session is running otherwise ``False``.
              Default: ``False``
          """
          labels = []
          step = []
          loss = []
          timestamps = []
          last_step = -1
          live_data = is_training and session_id == max(self._log_filenames)
  
          if live_data:
              iterator = self._get_latest_live()
          else:
              iterator = tf.compat.v1.io.tf_record_iterator(self._log_filenames[session_id])
  
          try:
              for record in iterator:
                  event = event_pb2.Event.FromString(record)
                  if not event.summary.value or not event.summary.value[0].tag.startswith("batch_"):
                      continue
  
                  if last_step == -1:
                      last_step = event.step if live_data else 0
  
                  if event.step != last_step:
                      loss.append(step)
                      step = []
                      last_step = event.step
  
                  summary = event.summary.value[0]
                  tag = summary.tag
  
                  if tag == "batch_total":
                      timestamps.append(event.wall_time)
                      continue
  
                  lbl = tag.replace("batch_", "")
                  if lbl not in labels:
                      labels.append(lbl)
  
                  step.append(summary.simple_value)
  
          except tf_errors.DataLossError as err:
              logger.warning("The logs for Session %s are corrupted and cannot be displayed. "
                             "The totals do not include this session. Original error message: "
                             "'%s'", session_id, str(err))
  
          if step:
              loss.append(step)
  
          loss = np.array(loss, dtype="float32")
          timestamps = np.array(timestamps, dtype="float64")
  
          logger.debug("Caching session id: %s, labels: %s, loss: %s, timestamps: %s",
                       session_id, labels, loss.shape, timestamps.shape)
  
          if live_data and session_id in self._cache:
              self._add_latest_data_to_cache(session_id, loss, timestamps)
          else:
              self._cache[session_id] = dict(labels=labels,
                                             loss=zlib.compress(loss),
                                             loss_shape=loss.shape,
                                             timestamps=zlib.compress(timestamps),
                                             timestamps_shape=timestamps.shape)
code_tokens: def _cache_data ( self , session_id , is_training = False ) : labels = [ ] step = [ ] loss = [ ] timestamps = [ ] last_step = - 1 live_data = is_training and session_id == max ( self . _log_filenames ) if live_data : iterator = self . _get_latest_live ( ) else : iterator = tf . compat . v1 . io . tf_record_iterator ( self . _log_filenames [ session_id ] ) try : for record in iterator : event = event_pb2 . Event . FromString ( record ) if not event . summary . value or not event . summary . value [ 0 ] . tag . startswith ( "batch_" ) : continue if last_step == - 1 : last_step = event . step if live_data else 0 if event . step != last_step : loss . append ( step ) step = [ ] last_step = event . step summary = event . summary . value [ 0 ] tag = summary . tag if tag == "batch_total" : timestamps . append ( event . wall_time ) continue lbl = tag . replace ( "batch_" , "" ) if lbl not in labels : labels . append ( lbl ) step . append ( summary . simple_value ) except tf_errors . DataLossError as err : logger . warning ( "The logs for Session %s are corrupted and cannot be displayed. " "The totals do not include this session. Original error message: " "'%s'" , session_id , str ( err ) ) if step : loss . append ( step ) loss = np . array ( loss , dtype = "float32" ) timestamps = np . array ( timestamps , dtype = "float64" ) logger . debug ( "Caching session id: %s, labels: %s, loss: %s, timestamps: %s" , session_id , labels , loss . shape , timestamps . shape ) if live_data and session_id in self . _cache : self . _add_latest_data_to_cache ( session_id , loss , timestamps ) else : self . _cache [ session_id ] = dict ( labels = labels , loss = zlib . compress ( loss ) , loss_shape = loss . shape , timestamps = zlib . compress ( timestamps ) , timestamps_shape = timestamps . shape )
short_docstring: Cache TensorBoard logs for the given session ID on first access.
short_docstring_tokens: Cache TensorBoard logs for the given session ID on first access .
comment: """ Cache TensorBoard logs for the given session ID on first access.
  
          Populates :attr:`_cache` with timestamps and loss data.
  
          If this is a training session and the data is being queried for the training session ID
          then get the latest available data and append to the cache
  
          Parameters
          -------
          session_id: int
              The session ID to cache the data for
          is_training: bool, optional
              ``True`` if a current training session is running otherwise ``False``.
              Default: ``False``
          """