code: def test_layer_norm(device, affine, mode):
      x = torch.randn(100, 16, device=device)
      batch = torch.zeros(100, dtype=torch.long, device=device)
  
      norm = LayerNorm(16, affine=affine, mode=mode).to(device)
      assert str(norm) == f"LayerNorm(16, affine={affine}, mode={mode})"
  
      if is_full_test():
          torch.jit.script(norm)
  
      out1 = norm(x)
      assert out1.size() == (100, 16)
      assert torch.allclose(norm(x, batch), out1, atol=1e-6)
  
      out2 = norm(
          torch.cat([x, x], dim=0), torch.cat([batch, batch + 1], dim=0)
      )
      assert torch.allclose(out1, out2[:100], atol=1e-6)
      assert torch.allclose(out1, out2[100:], atol=1e-6)
  
imports: import pytest
  import torch
  from torch_geometric.nn import HeteroLayerNorm, LayerNorm
  from torch_geometric.testing import is_full_test, withCUDA
label_desc: Use image node_id 1 for calling a global function with example usage: test_layer_norm(device, affine, mode) without return types