code: def test_pytorch_autolog_logging_forked_metrics_on_step_and_epoch(
      pytorch_model_with_steps_logged,
  ):
      # When autolog is configured to log on steps as well as epochs,
      # then we only log step based metrics per step and not on epochs.
      (
          trainer,
          run,
          log_every_n_epoch,
          log_every_n_step,
      ) = pytorch_model_with_steps_logged
      num_logged_steps = trainer.global_step // log_every_n_step
      num_logged_epochs = NUM_EPOCHS // log_every_n_epoch
  
      client = MlflowClient()
      for metric_key, expected_len in [
          ("train_acc", num_logged_epochs),
          ("loss", num_logged_steps),
          ("loss_forked", num_logged_epochs),
          ("loss_forked_step", num_logged_steps),
          ("loss_forked_epoch", num_logged_epochs),
      ]:
          assert (
              metric_key in run.data.metrics
          ), f"Missing {metric_key} in metrics"
          metric_history = client.get_metric_history(
              run.info.run_id, metric_key
          )
          assert (
              len(metric_history) == expected_len
          ), f"Expected {expected_len} values for {metric_key}, got {len(metric_history)}"
  
imports: import pytest
  import pytorch_lightning
  import torch
  from iris import IrisClassification, IrisClassificationMultiOptimizer, IrisClassificationWithoutValidation
  from iris_data_module import IrisDataModule, IrisDataModuleWithoutValidation
  from packaging.version import Version
  from pytorch_lightning.callbacks import ModelCheckpoint
  from pytorch_lightning.callbacks.early_stopping import EarlyStopping
  import mlflow
  import mlflow.pytorch
  from mlflow import MlflowClient
  from mlflow.exceptions import MlflowException
  from mlflow.pytorch._lightning_autolog import _get_optimizer_name
  from mlflow.utils.file_utils import TempDir
label_desc: Use image node_id 10 for calling a global function with example usage: test_pytorch_autolog_logging_forked_metrics_on_step_and_epoch(pytorch_model_with_steps_logged) without return types