max pooling for pairwise potential in psi