How can I write transform from higher dimensions to lower dimensions in NumPyro?

I want to write transform for f:\mathbb{R}^2\to\mathbb{R}. For example, \displaystyle f(m_1,m_2)=\frac{m_2}{m_1}. Problems come when there is no determinant for rectangular matrices. In this case, how can we do it and what will happen to the log_abs_det_jacobian on the Transform class?

transforms need to be bijective. what is your actual goal?

I want to use a mapping, not a bijective transformation. Specifically, I have models generating masses (m_1 and m_2) and want to mix them with other univariate distributions. I’ve found that Numpyro transforms are the most efficient way to handle this situation, as they provide a smooth and flexible way to work with these distributions.

generically speaking “mixing” distributions in that way leads to a distribution without a closed-form pdf, i.e. i can’t compute the normalized pdf of p_1(x)/p_2(x) in a simple way from p_1(x) and p_2(x). indeed such a distribution isn’t even guaranteed to be normalizable

What if we introduce a dummy variable such as M=m_1+m_2 for the transformation? Then, we can make it a bijective transformation from (m_1,m_2) -> (q, M) where m_1 and m_2 are generated from one distribution and q = m2/m1 are generated from another distribution.