import torch as tr def bra_ket(a,b): c=tr.einsum("i,i->",a,b) return c