code: def rebuild_cp_decomposition(up, down, mid):
      up = up.reshape(up.size(0), -1)
      down = down.reshape(down.size(0), -1)
      return torch.einsum("n m k l, i n, m j -> i j k l", mid, up, down)
  
imports: import torch
label_desc: Use image node_id 3 for calling a global function with example usage: rebuild_cp_decomposition(up, down, mid) and returns: torch