code: def test_perm_fn_broadcastable_masks(self) -> None:
      batch_size = 5
      inp_size = (3, 20, 30)
  
      inp = torch.randn((batch_size,) + inp_size)
  
      # To be broadcastable dimensions have
      # match from end to beginning, by equalling 1 or the dim.
      #
      # If a dimension is missing then it must be the
      # last dim provided (from right to left). The missing
      # dimensions are implied to be = 1
      #
      # Here I write them explicitly for clarity
      mask_sizes: List[Tuple[int, ...]] = [
          # dims = 1
          (1, 20, 30),
          (3, 1, 30),
          (3, 20, 1),
          (1, 1, 30),
          (1, 20, 1),
          # missing
          (1,),  # empty set (all features)
          (30,),
          (20, 30),
          (3, 20, 30),
      ]
  
      for mask_size in mask_sizes:
          mask = torch.randint(0, 2, mask_size).bool()
          self.assertTrue(mask.shape == mask_size)
  
          self._check_perm_fn_with_mask(inp, mask)
  
file_path: captum/tests/attr/test_feature_permutation.py
imports: from typing import List, Tuple
  import torch
  from captum.attr._core.feature_permutation import _permute_feature, FeaturePermutation
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModelWithSparseInputs
  from torch import Tensor
label_desc: Use image node_id 4 for calling the Test obj's underlying member method code with example usage: obj.test_perm_fn_broadcastable_masks() without return types