class_docstr: MetricsLogger collects metrics measured during experiments.
  
  MetricsLogger is the (only) part of the Metrics API.
  An instance of the class should be created for the Run class, such that the
  log_scalar_metric method is accessible from running experiments using
  _run.metrics.log_scalar_metric.
docstr: Add a new measurement.
  
  The measurement will be processed by the MongoDB observer
  during a heartbeat event.
  Other observers are not yet supported.
  
  :param metric_name: The name of the metric, e.g. training.loss.
  :param value: The measured value.
  :param step: The step number (integer), e.g. the iteration number
              If not specified, an internal counter for each metric
              is used, incremented by one.
docstr_tok: ["Add","a","new","measurement",".","The","measurement","will","be","processed","by","the","MongoDB","observer","during","a","heartbeat","event",".","Other","observers","are","not","yet","supported",".",":","param","metric_name",":","The","name","of","the","metric",",","e.g",".","training.loss",".",":","param","value",":","The","measured","value",".",":","param","step",":","The","step","number","(","integer",")",",","e.g",".","the","iteration","number","If","not","specified",",","an","internal","counter","for","each","metric","is","used",",","incremented","by","one","."]
code: def log_scalar_metric(self, metric_name, value, step=None):
      """
      Add a new measurement.
  
      The measurement will be processed by the MongoDB observer
      during a heartbeat event.
      Other observers are not yet supported.
  
      :param metric_name: The name of the metric, e.g. training.loss.
      :param value: The measured value.
      :param step: The step number (integer), e.g. the iteration number
                  If not specified, an internal counter for each metric
                  is used, incremented by one.
      """
      if opt.has_numpy:
          np = opt.np
          if isinstance(value, np.generic):
              value = value.item()
          if isinstance(step, np.generic):
              step = step.item()
      if step is None:
          step = self._metric_step_counter.get(metric_name, -1) + 1
      self._logged_metrics.put(
          ScalarMetricLogEntry(
              metric_name, step, datetime.datetime.utcnow(), value
          )
      )
      self._metric_step_counter[metric_name] = step
  
file_path: sacred/sacred/metrics_logger.py
imports: import datetime
  import sacred.optional
  from queue import Queue, Empty
label_desc: Use image node_id 2 for calling the MetricsLogger obj's underlying member method code with example usage: obj.log_scalar_metric(metric_name, value, step) without return types