code: def test_pre_norm(normalization):
      # Check that passing the same tensor a bunch of times skips the extra normalizations
      x = torch.rand((3, 3), requires_grad=True)
  
      wrap = PreNorm(
          d_norm=3,
          sublayer=Passthrough(),
          normalization=normalization,
          use_triton=False,
      )
      outputs = wrap(inputs=[x, x, x])
  
      assert id(outputs[0]) == id(outputs[1])
  
      # Check the BW pass
      torch.sum(outputs[0]).backward()
  
file_path: xformers/tests/test_residual.py
imports: import pytest
  import torch
  from xformers.components import NormalizationType, PreNorm
label_desc: Use image node_id 1 for calling a global function with example usage: test_pre_norm(normalization) without return types