code: def khatri_rao(matrices):
      
  
      n_columns = matrices[0].shape[1]
      n_factors = len(matrices)
  
      start = ord('a')
      common_dim = 'z'
      target = ''.join(chr(start + i) for i in range(n_factors))
      source = ','.join(i+common_dim for i in target)
      operation = source+'->'+target+common_dim
      return np.einsum(operation, *matrices).reshape((-1, n_columns))
docs: Khatri-Rao product of a list of matrices.
  
      Parameters
      ----------
      matrices : list of ndarray
  
      Returns
      -------
      khatri_rao_product: matrix of shape ``(prod(n_i), m)``
          where ``prod(n_i) = prod([m.shape[0] for m in matrices])``
          i.e. the product of the number of rows of all the matrices in the
          product.
  
      Author
      ------
      Jean Kossaifi <https://github.com/tensorly>