code: def _linear_superposition(alphas, vecs, shape):
      """Calculate the tensor superposition along axis 1 of vecs with coefficient alphas using einsum.
  
      Parameters
      ----------
      alphas
          Coefficients of the superposition.
      vecs
          Tensors of the superposition.
      shape
          Shape of each tensor.
  
      Returns
      -------
      Linear tensor superposition.
      """
      input_str = string.ascii_lowercase[2 : 2 + len(shape)]
      einstr = "a,ba{}->b{}".format(input_str, input_str)
      return np.einsum(einstr, alphas, vecs)
  
file_path: alibi/alibi/confidence/model_linearity.py
imports: import logging
  import string
  from time import time
  from typing import Callable, List, Optional, Tuple, Union
  import numpy
  from numpy.linalg import norm
  from sklearn.neighbors import NearestNeighbors
label_desc: Use image node_id 1 for calling a global function with example usage: _linear_superposition(alphas, vecs, shape) and returns: np