code: def test_result_collection_no_batch_size_extraction():
      results = _ResultCollection(training=True)
      results.batch = torch.randn(1, 4)
      fx_name = "training_step"
      batch_size = 10
      log_val = torch.tensor(7.0)
  
      train_mae = MeanAbsoluteError()
      train_mae(torch.randn(4, 5), torch.randn(4, 5))
      results.log(
          fx_name, "step_log_val", log_val, on_step=True, on_epoch=False
      )
      results.log(
          fx_name,
          "epoch_log_val",
          log_val,
          on_step=False,
          on_epoch=True,
          batch_size=batch_size,
      )
      results.log(
          fx_name,
          "epoch_sum_log_val",
          log_val,
          on_step=True,
          on_epoch=True,
          reduce_fx="sum",
      )
      results.log(
          fx_name, "train_mae", train_mae, on_step=True, on_epoch=False
      )
  
      assert results.batch_size is None
      assert isinstance(
          results["training_step.train_mae"].value, MeanAbsoluteError
      )
      assert results["training_step.step_log_val"].value == log_val
      assert (
          results["training_step.step_log_val"].cumulated_batch_size
          == 0
      )
      assert (
          results["training_step.epoch_log_val"].value
          == log_val * batch_size
      )
      assert (
          results["training_step.epoch_log_val"].cumulated_batch_size
          == batch_size
      )
      assert results["training_step.epoch_sum_log_val"].value == log_val
  
imports: import operator
  from functools import partial
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  import torch
  from lightning.pytorch import LightningModule
  from lightning.pytorch.callbacks.callback import Callback
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.loggers import CSVLogger
  from lightning.pytorch.trainer import Trainer
  from lightning.pytorch.trainer.connectors.logger_connector.fx_validator import _FxValidator
  from lightning.pytorch.trainer.connectors.logger_connector.result import _ResultCollection
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_0_9_1
  from lightning.pytorch.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_0_11
  from lightning_utilities.core.imports import compare_version
  from torch.utils.data import DataLoader
  from torchmetrics import Accuracy, MeanAbsoluteError, MeanSquaredError, MetricCollection
  from torchmetrics import AveragePrecision
  from tests_pytorch.models.test_hooks import get_members
label_desc: Use image node_id 9 for calling a global function with example usage: test_result_collection_no_batch_size_extraction() without return types