code: def test_jacobian_scores_batch_scalar_multilayer(self) -> None:
      model = BasicLinearModel_Multilayer(5, 2, 1)
      model.linear1.weight = nn.Parameter(
          torch.arange(0, 10).view(2, 5).float()
      )
      model.linear2.weight = nn.Parameter(
          torch.arange(1, 3).view(1, 2).float()
      )
  
      a = torch.stack((torch.ones(5), torch.ones(5) * 2))
  
      grads = _compute_jacobian_wrt_params(model, (a,))
      assertTensorAlmostEqual(
          self, grads[0][0], torch.stack((a[0], 2 * a[0]))
      )
      assertTensorAlmostEqual(
          self, grads[1][0], torch.Tensor([[10, 35]])
      )
      assertTensorAlmostEqual(
          self, grads[0][1], torch.stack((a[1], 2 * a[1]))
      )
      assertTensorAlmostEqual(
          self, grads[1][1], torch.Tensor([[20, 70]])
      )
  
      grads = _compute_jacobian_wrt_params_with_sample_wise_trick(
          model, (a,)
      )
      assertTensorAlmostEqual(
          self, grads[0][0], torch.stack((a[0], 2 * a[0]))
      )
      assertTensorAlmostEqual(
          self, grads[1][0], torch.Tensor([[10, 35]])
      )
      assertTensorAlmostEqual(
          self, grads[0][1], torch.stack((a[1], 2 * a[1]))
      )
      assertTensorAlmostEqual(
          self, grads[1][1], torch.Tensor([[20, 70]])
      )
  
imports: import torch
  import torch.nn
  from captum._utils.gradient import _compute_jacobian_wrt_params, _compute_jacobian_wrt_params_with_sample_wise_trick
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicLinearModel2, BasicLinearModel_Multilayer
label_desc: Use image node_id 7 for calling the Test obj's underlying member method code with example usage: obj.test_jacobian_scores_batch_scalar_multilayer() without return types