In this paper, we will use optimal mass transport combining with suitable transforms to study the sharp constants and optimizers for a class of the Gagliardo–Nirenberg and Caffarelli–Kohn–Nirenberg inequalities. Moreover, we will investigate these inequalities with and without the monomial weights $x_{1}^{A_{1}} \cdots x_{N}^{A_{N}}$ on ℝN.