code: def test_gradient_basic_2(self) -> None:
      model = BasicModel()
      input = torch.tensor([[-3.0]], requires_grad=True)
      input.grad = torch.tensor([[14.0]])
      grads = compute_gradients(model, input)[0]
      assertTensorAlmostEqual(
          self, grads, [[1.0]], delta=0.01, mode="max"
      )
      # Verify grad attribute is not altered
      assertTensorAlmostEqual(
          self, input.grad, [[14.0]], delta=0.0, mode="max"
      )
  
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 4 for calling the Test obj's underlying member method code with example usage: obj.test_gradient_basic_2() without return types