code: def test_apply_gradient_reqs(self) -> None:
      initial_grads = [False, True, False]
      test_tensor = torch.tensor([[6.0]], requires_grad=True)
      test_tensor.grad = torch.tensor([[7.0]])
      test_tensor_tuple = (
          torch.tensor([[5.0]]),
          test_tensor,
          torch.tensor([[7.0]]),
      )
      out_mask = apply_gradient_requirements(test_tensor_tuple)
      for i in range(len(test_tensor_tuple)):
          self.assertTrue(test_tensor_tuple[i].requires_grad)
          self.assertEqual(out_mask[i], initial_grads[i])
  
imports: from typing import List, Tuple
  import torch
  from captum._utils.gradient import apply_gradient_requirements, compute_gradients, compute_layer_gradients_and_eval, undo_gradient_requirements
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModel, BasicModel2, BasicModel4_MultiArgs, BasicModel5_MultiArgs, BasicModel6_MultiTensor, BasicModel_MultiLayer
label_desc: Use image node_id 1 for calling the Test obj's underlying member method code with example usage: obj.test_apply_gradient_reqs() without return types