code: def test_shapley_sampling_multi_task_output_with_mask(self) -> None:
      # return shape (batch size, 2)
      net1 = BasicModel_MultiLayer()
  
      # return shape (batch size, 4)
      def forward_func(*args, **kwargs):
          net_output = net1(*args, **kwargs)
          batch_size = net_output.size(0)
          constant = torch.ones(batch_size, 1)
  
          output = torch.cat(
              [
                  net_output,
                  constant,
              ],
              dim=-1,
          )
          return output
  
      inp = torch.tensor(
          [[20.0, 50.0, 30.0], [20.0, 50.0, 30.0]], requires_grad=True
      )
      mask = torch.tensor([[1, 1, 0], [0, 1, 1]])
  
      self._shapley_test_assert(
          forward_func,
          inp,
          [
              [
                  [275.0, 275.0, 115.0],
                  [275.0, 275.0, 115.0],
                  [0, 0, 0],
              ],
              [
                  [75.0, 315.0, 315.0],
                  [75.0, 315.0, 315.0],
                  [0, 0, 0],
              ],
          ],
          target=None,  # no target, multi-task output for all classes
          perturbations_per_eval=(1, 2, 3),
          n_samples=150,
          test_true_shapley=True,
          feature_mask=mask,
      )
  
imports: import io
  import unittest
  import unittest.mock
  from typing import Any, Callable, Tuple, Union
  import torch
  from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.shapley_value import ShapleyValues, ShapleyValueSampling
  from tests.helpers.basic import assertTensorTuplesAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModel_MultiLayer, BasicModel_MultiLayer_MultiInput, BasicModelBoolInput
label_desc: Use image node_id 11 for calling the Test obj's underlying member method code with example usage: obj.test_shapley_sampling_multi_task_output_with_mask() and returns: output