code: def test_pytorch_parity(
      cls_model: LightningModule,
      max_diff_speed: float,
      max_diff_memory: float,
      num_epochs: int,
      num_runs: int,
  ):
      """Verify that the same  pytorch and lightning models achieve the same results."""
      lightning = measure_loops(
          cls_model,
          kind="PT Lightning",
          loop=lightning_loop,
          num_epochs=num_epochs,
          num_runs=num_runs,
      )
      vanilla = measure_loops(
          cls_model,
          kind="Vanilla PT",
          loop=vanilla_loop,
          num_epochs=num_epochs,
          num_runs=num_runs,
      )
  
      # make sure the losses match exactly  to 5 decimal places
      print(
          f"Losses are for... \n vanilla: {vanilla['losses']} \n lightning: {lightning['losses']}"
      )
      for pl_out, pt_out in zip(lightning["losses"], vanilla["losses"]):
          np.testing.assert_almost_equal(pl_out, pt_out, 5)
  
      # drop the first run for initialize dataset (download & filter)
      assert_parity_absolute(
          lightning["durations"][1:],
          vanilla["durations"][1:],
          norm_by=num_epochs,
          max_diff=max_diff_speed,
      )
  
      assert_parity_relative(
          lightning["memory"],
          vanilla["memory"],
          max_diff=max_diff_memory,
      )
  
file_path: pytorch-lightning/tests/parity_pytorch/test_basic_parity.py
imports: import os
  import numpy
  import pytest
  import torch
  from lightning.pytorch import LightningModule, Trainer, seed_everything
  from tests_pytorch.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN
  from parity_pytorch.measure import measure_loops
  from parity_pytorch.models import ParityModuleCIFAR
label_desc: Use image node_id 3 for calling a global function with example usage: test_pytorch_parity(cls_model, max_diff_speed, max_diff_memory, num_epochs, num_runs) without return types