code: def test_squeeze_excite_equivalency(self):
      # Input tensor
      input_tensor = torch.randn(1, 16, 4, 6, 6)
      # Instantiate ref and convert se modules.
      se_ref = SqueezeExcitation(16, num_channels_reduced=2, is_3d=True)
      se_ref.eval()
      se_convert = deepcopy(se_ref)
      se_convert.convert((1, 16, 4, 6, 6))
      # Get output of both activations
      out0 = se_ref(input_tensor)
      out1 = se_convert(input_tensor)
      # Check arithmetic equivalency
      max_err = float(torch.max(torch.abs(out0 - out1)))
      rel_err = torch.abs((out0 - out1) / out0)
      max_rel_err = float(torch.max(rel_err))
  
      logging.info(
          (
              "test_squeeze_excite_equivalency: "
              f"max_err {max_err}, max_rel_err {max_rel_err}"
          )
      )
      self.assertTrue(max_err < 1e-3)
  
file_path: pytorchvideo/tests/test_accelerator_efficient_blocks_mobile_cpu_activation_attention.py
imports: import logging
  import unittest
  from copy import deepcopy
  import torch
  from pytorchvideo.layers.accelerator.mobile_cpu.activation_functions import supported_act_functions
  from pytorchvideo.layers.accelerator.mobile_cpu.attention import SqueezeExcitation
label_desc: Use image node_id 2 for calling the TestActivationAttentionEquivalency obj's underlying member method code with example usage: obj.test_squeeze_excite_equivalency() without return types