code: def test_log_scalar_metrics_with_implicit_step(ex):
      messages = {}
  
      @ex.main
      def main_function(_run):
          for i in range(10):
              val = i * i
              ex.log_scalar("training.loss", val)
              ex.log_scalar("training.accuracy", val + 1)
          messages[
              "messages"
          ] = ex.current_run._metrics.get_last_metrics()
  
      ex.run()
      assert ex.current_run is not None
      messages = messages["messages"]
      tr_loss_messages = [
          m for m in messages if m.name == "training.loss"
      ]
      tr_acc_messages = [
          m for m in messages if m.name == "training.accuracy"
      ]
  
      assert len(tr_loss_messages) == 10
      # both should have 10 records
      assert len(tr_acc_messages) == len(tr_loss_messages)
      for i in range(len(tr_loss_messages) - 1):
          assert tr_loss_messages[i].step < tr_loss_messages[i + 1].step
          assert tr_loss_messages[i].step == i
          assert (
              tr_loss_messages[i].timestamp
              <= tr_loss_messages[i + 1].timestamp
          )
  
          assert tr_acc_messages[i].step < tr_acc_messages[i + 1].step
          assert tr_acc_messages[i].step == i
          assert (
              tr_acc_messages[i].timestamp
              <= tr_acc_messages[i + 1].timestamp
          )
  
file_path: sacred/tests/test_metrics_logger.py
imports: import datetime
  import pytest
  from sacred import Experiment
  from sacred.metrics_logger import ScalarMetricLogEntry, linearize_metrics
label_desc: Use image node_id 5 for calling a global function with example usage: test_log_scalar_metrics_with_implicit_step(ex) without return types