code: def test_channel_norm_2d(affine, arange_4d_image: Tensor):
      if arange_4d_image.shape[1] == 1:
          return
      norm = ChannelNorm2D(arange_4d_image.shape[1], affine=affine)
  
      mean = torch.mean(arange_4d_image, dim=1, keepdim=True)
      variance = torch.var(arange_4d_image, dim=1, keepdim=True)
  
      x_normed = (arange_4d_image - mean) * torch.rsqrt(
          variance + norm.epsilon
      )
      if affine is True:
          x_normed = norm.gamma * x_normed + norm.beta
  
      output = norm(arange_4d_image)
  
      assert torch.allclose(output, x_normed)
  
imports: import pytest
  import torch
  from torch import Tensor
  from neuralcompression.layers import ChannelNorm2D
label_desc: Use image node_id 1 for calling a global function with example usage: test_channel_norm_2d(affine, arange_4d_image) without return types