code: def test_compositing_transparencies(self):
      # When foreground layer is transparent and surface and bg are semi-transparent,
      # we should return a  mix of the two latter.
      N, H, W = 2, 3, 4
      color_layers = torch.rand((N, H, W, 4, 3))
      color_layers[..., 3, 0] = 0.1  # fg
      color_layers[..., 3, 1] = 0.2  # surface
      color_layers[..., 3, 2] = 0.3  # bg
      color_weights = torch.ones((N, H, W, 1, 3))
  
      out_colors = _normalize_and_compose_all_layers(
          torch.tensor([0.0, 0.0, 0.0]), color_layers, color_weights
      )
      self.assertClose(
          out_colors,
          color_layers[..., 0]
          + 0.9 * (color_layers[..., 1] + 0.8 * color_layers[..., 2]),
      )
  
imports: import unittest
  import torch
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.renderer.cameras import FoVPerspectiveCameras
  from pytorch3d.renderer.splatter_blend import _compute_occlusion_layers, _compute_splatted_colors_and_weights, _compute_splatting_colors_and_weights, _get_splat_kernel_normalization, _normalize_and_compose_all_layers, _offset_splats, _precompute, _prepare_pixels_and_colors
  from .common_testing import TestCaseMixin
label_desc: Use image node_id 3 for calling the TestNormalizeAndComposeAllLayers obj's underlying member method code with example usage: obj.test_compositing_transparencies() without return types