code: def _flatten_tensors(tensors: Sequence[torch.Tensor]) -> torch.Tensor:
      """
      Unwraps a list of parameters gradients
  
      # Returns
  
      `torch.Tensor`
          A tensor of shape `(x,)` where `x` is the total number of entires in the gradients.
      """
      views = []
      for p in tensors:
          if p.data.is_sparse:
              view = p.data.to_dense().view(-1)
          else:
              view = p.data.view(-1)
          views.append(view)
      return torch.cat(views, 0)
  
file_path: allennlp/allennlp/interpret/influence_interpreters/simple_influence.py
imports: import logging
  from typing import List, Optional, Tuple, Union, Sequence
  import numpy
  import torch
  import torch.autograd
  from allennlp.common import Lazy
  from allennlp.common.tqdm import Tqdm
  from allennlp.data import DatasetReader, DatasetReaderInput, Instance
  from allennlp.data.data_loaders import DataLoader, SimpleDataLoader
  from allennlp.interpret.influence_interpreters.influence_interpreter import InfluenceInterpreter
  from allennlp.models.model import Model
label_desc: Use image node_id 3 for calling a global function with example usage: _flatten_tensors(tensors) and returns: torch