code: def test_flatten_tensors():
      A = torch.nn.Parameter(
          torch.tensor([[1.0, 2.0], [3.0, 4.0]]), requires_grad=True
      )
      B = torch.nn.Parameter(
          torch.tensor([[5.0, 6.0], [7.0, 8.0]]), requires_grad=True
      )
      flatten_grad = _flatten_tensors([A, B])
      ans = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8]).float()
      assert torch.equal(flatten_grad, ans)
  
file_path: allennlp/tests/interpret/simple_influence_test.py
imports: import torch
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data.vocabulary import Vocabulary
  from allennlp.data.fields import TensorField
  from allennlp.data import Instance
  from allennlp.models.model import Model
  from allennlp.data.data_loaders import SimpleDataLoader
  from allennlp.interpret import InfluenceInterpreter
  from allennlp.interpret.influence_interpreters.simple_influence import _flatten_tensors, get_hvp, get_inverse_hvp_lissa
label_desc: Use image node_id 2 for calling a global function with example usage: test_flatten_tensors() without return types