This is not correct.
The Jacobian adjustment is for a 1-1 transformation which always
yields a square Jacobian. For many-to-one or one-to-many
transformations you have to first construct a 1-1 transformation
with auxiliary parameters and then marginalize out the auxiliary
parameters from the resulting joint distribution. For example,
if you had pi(x, y) and wanted the density for r = sqrt(x^2 + y^2)
then you could compute
pi(r) = \int d(theta) pi(r, theta) = \int d(theta) pi( x(r, theta), y(r, theta) ) | J (r, theta) |
Additionally, computing J and then calling log_determinant will be
viciously inefficient. You almost always want to (and can) figure
out the log Jacobian determinant analytically.