Repository: pytorch
Issue: The sign of torch.distributions.transforms.PowerTransform seems to be incorrect
Labels: module: distributions,triaged

### 🐛 Describe the bug

The sign of the Jacobian determinant of `torch.distributions.transforms.PowerTransform` seems to be incorrect. In the current version, the sign is assigned to be a constant `sign = +1` on line 550. However, I think the sign of the Jacobian determinant should depend on both the exponent and the input instead of just a constant.

To further describe the issue, see the customized construction of a Generalized Pareto Distribution (GPD) below. I have to manually overwrite the `_monotonize_cdf` method in order to construct a correct CDF. Specifically, there are 3 transformations I use to transform u ~ Unif(0,1) into GPD. The sign of `AffineTransform` is the same as `self.shape`, which is correct. Therefore, if the sign of `PowerTransform` is +1, then this makes the sign of the full transformation dependent on the sign of `self.alpha`, which does not make sense. Also, according to the definition of `_monotonize_cdf` in `torch.distributions.transformed_distribution.TransformedDistribution`, the sign of the full transformation ensures that the CDF is monotonically increasing. Therefore, if the sign of the full transformation is dependent on `self.alpha`, then it is not guaranteed that the CDF is always monotonically increasing.
```
class GeneralizedPareto(TransformedDistribution):
    """
    Samples from a Generalized Pareto distribution

    Arguments
    --------------
    loc: location parameter of the distribution
    scale: scale parameter of the distribution
    alpha: shape parameter of the distribution
    """
    arg_constraints = {'loc': constraints.real, 'scale': constraints.positive, 'alpha': _NonZero()}

    def __init__(self, loc, scale, alpha, validate_args=None):
        self.loc, self.scale, self.alpha = broadcast_all(loc, scale, alpha)
        base_dist = Uniform(0, 1)
        transforms = [
            PowerTransform(-self.alpha), 
            AffineTransform(loc=-1, scale=torch.ones_like(self.scale)), 
            AffineTransform(loc=loc, scale=self.scale/self.alpha)
        ]
        super(GeneralizedPareto, self).__init__(base_dist, transforms, validate_args=validate_args)

    def _monotonize_cdf(self, value):
        """
        Overwrite the default _monotonize_cdf method to construct the correct CDF
        (Subject to change) The sign of det(jacobian) of the PowerTransform in the current version
        of PyTorch is incorrect. This is a temporary fix.
        """
        return 1 - value
```

### Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: macOS 12.0.1 (x86_64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.5 (default, May 18 2021, 12:31:01)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Apple M1 Pro

Versions of relevant libraries:
[pip3] numpy==1.23.1
[conda] numpy                     1.23.1                   pypi_0    pypi

cc @fritzo @neerajprad @alicanb @nikitaved