We consider a general statistical inference model of finite-rank tensor products. For any interaction structure and order products, we identify the limit free energy in terms variational formula. Our approach consists showing first that must be viscosity solution to certain Hamilton–Jacobi equation.