We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
TweedieDevianceScore producing nan results when setting power=1.0
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

### To Reproduce

```>>> td=TweedieDevianceScore(power=1.0)
>>> targets=torch.tensor([0,1,0,1])
>>> preds=torch.tensor([0.1,0.1,0.1,0.1])
>>> td(preds,targets)
tensor(nan)
>>> td=TweedieDevianceScore(power=1.0001)
>>> td(preds,targets)
tensor(1.5038)```

I assume this is a bug since the documentation says targets >= 0 (obviously Poisson data will often be 0). 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `torchmetrics/functional/regression/tweedie_deviance.py`
Content:
```
1 # Copyright The PyTorch Lightning team.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from typing import Tuple
15 
16 import torch
17 from torch import Tensor
18 
19 from torchmetrics.utilities.checks import _check_same_shape
20 
21 
22 def _tweedie_deviance_score_update(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tuple[Tensor, Tensor]:
23     """Updates and returns variables required to compute Deviance Score for the given power. Checks for same shape
24     of input tensors.
25 
26     Args:
27         preds: Predicted tensor
28         targets: Ground truth tensor
29         power: see :func:`tweedie_deviance_score`
30 
31     Example:
32         >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])
33         >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])
34         >>> _tweedie_deviance_score_update(preds, targets, power=2)
35         (tensor(4.8333), tensor(4))
36     """
37     _check_same_shape(preds, targets)
38 
39     zero_tensor = torch.zeros(preds.shape, device=preds.device)
40 
41     if 0 < power < 1:
42         raise ValueError(f"Deviance Score is not defined for power={power}.")
43 
44     if power == 0:
45         deviance_score = torch.pow(targets - preds, exponent=2)
46     elif power == 1:
47         # Poisson distribution
48         if torch.any(preds <= 0) or torch.any(targets < 0):
49             raise ValueError(
50                 f"For power={power}, 'preds' has to be strictly positive and 'targets' cannot be negative."
51             )
52 
53         deviance_score = 2 * (targets * torch.log(targets / preds) + preds - targets)
54     elif power == 2:
55         # Gamma distribution
56         if torch.any(preds <= 0) or torch.any(targets <= 0):
57             raise ValueError(f"For power={power}, both 'preds' and 'targets' have to be strictly positive.")
58 
59         deviance_score = 2 * (torch.log(preds / targets) + (targets / preds) - 1)
60     else:
61         if power < 0:
62             if torch.any(preds <= 0):
63                 raise ValueError(f"For power={power}, 'preds' has to be strictly positive.")
64         elif 1 < power < 2:
65             if torch.any(preds <= 0) or torch.any(targets < 0):
66                 raise ValueError(
67                     f"For power={power}, 'targets' has to be strictly positive and 'preds' cannot be negative."
68                 )
69         else:
70             if torch.any(preds <= 0) or torch.any(targets <= 0):
71                 raise ValueError(f"For power={power}, both 'preds' and 'targets' have to be strictly positive.")
72 
73         term_1 = torch.pow(torch.max(targets, zero_tensor), 2 - power) / ((1 - power) * (2 - power))
74         term_2 = targets * torch.pow(preds, 1 - power) / (1 - power)
75         term_3 = torch.pow(preds, 2 - power) / (2 - power)
76         deviance_score = 2 * (term_1 - term_2 + term_3)
77 
78     sum_deviance_score = torch.sum(deviance_score)
79     num_observations = torch.tensor(torch.numel(deviance_score), device=preds.device)
80 
81     return sum_deviance_score, num_observations
82 
83 
84 def _tweedie_deviance_score_compute(sum_deviance_score: Tensor, num_observations: Tensor) -> Tensor:
85     """Computes Deviance Score.
86 
87     Args:
88         sum_deviance_score: Sum of deviance scores accumalated until now.
89         num_observations: Number of observations encountered until now.
90 
91     Example:
92         >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])
93         >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])
94         >>> sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=2)
95         >>> _tweedie_deviance_score_compute(sum_deviance_score, num_observations)
96         tensor(1.2083)
97     """
98 
99     return sum_deviance_score / num_observations
100 
101 
102 def tweedie_deviance_score(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tensor:
103     r"""
104     Computes the `Tweedie Deviance Score`_ between targets and predictions:
105 
106     .. math::
107         deviance\_score(\hat{y},y) =
108         \begin{cases}
109         (\hat{y} - y)^2, & \text{for }power=0\\
110         2 * (y * log(\frac{y}{\hat{y}}) + \hat{y} - y),  & \text{for }power=1\\
111         2 * (log(\frac{\hat{y}}{y}) + \frac{y}{\hat{y}} - 1),  & \text{for }power=2\\
112         2 * (\frac{(max(y,0))^{2}}{(1 - power)(2 - power)} - \frac{y(\hat{y})^{1 - power}}{1 - power} + \frac{(\hat{y})
113             ^{2 - power}}{2 - power}), & \text{otherwise}
114         \end{cases}
115 
116     where :math:`y` is a tensor of targets values, and :math:`\hat{y}` is a tensor of predictions.
117 
118     Args:
119         preds: Predicted tensor with shape ``(N,...)``
120         targets: Ground truth tensor with shape ``(N,...)``
121         power:
122             - power < 0 : Extreme stable distribution. (Requires: preds > 0.)
123             - power = 0 : Normal distribution. (Requires: targets and preds can be any real numbers.)
124             - power = 1 : Poisson distribution. (Requires: targets >= 0 and y_pred > 0.)
125             - 1 < p < 2 : Compound Poisson distribution. (Requires: targets >= 0 and preds > 0.)
126             - power = 2 : Gamma distribution. (Requires: targets > 0 and preds > 0.)
127             - power = 3 : Inverse Gaussian distribution. (Requires: targets > 0 and preds > 0.)
128             - otherwise : Positive stable distribution. (Requires: targets > 0 and preds > 0.)
129 
130     Example:
131         >>> from torchmetrics.functional import tweedie_deviance_score
132         >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])
133         >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])
134         >>> tweedie_deviance_score(preds, targets, power=2)
135         tensor(1.2083)
136 
137     """
138     sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=power)
139     return _tweedie_deviance_score_compute(sum_deviance_score, num_observations)
140
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/torchmetrics/functional/regression/tweedie_deviance.py b/torchmetrics/functional/regression/tweedie_deviance.py
--- a/torchmetrics/functional/regression/tweedie_deviance.py
+++ b/torchmetrics/functional/regression/tweedie_deviance.py
@@ -19,6 +19,13 @@
 from torchmetrics.utilities.checks import _check_same_shape
 
 
+def xlogy(x: Tensor, y: Tensor) -> Tensor:
+    """Computes x * log(y). Returns 0 if x=0"""
+    res = x * torch.log(y)
+    res[x == 0] = 0.0
+    return res
+
+
 def _tweedie_deviance_score_update(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tuple[Tensor, Tensor]:
     """Updates and returns variables required to compute Deviance Score for the given power. Checks for same shape
     of input tensors.
@@ -50,7 +57,7 @@
                 f"For power={power}, 'preds' has to be strictly positive and 'targets' cannot be negative."
             )
 
-        deviance_score = 2 * (targets * torch.log(targets / preds) + preds - targets)
+        deviance_score = 2 * (xlogy(targets, targets / preds) + preds - targets)
     elif power == 2:
         # Gamma distribution
         if torch.any(preds <= 0) or torch.any(targets <= 0):

{"golden_diff": "diff --git a/torchmetrics/functional/regression/tweedie_deviance.py b/torchmetrics/functional/regression/tweedie_deviance.py\n--- a/torchmetrics/functional/regression/tweedie_deviance.py\n+++ b/torchmetrics/functional/regression/tweedie_deviance.py\n@@ -19,6 +19,13 @@\n from torchmetrics.utilities.checks import _check_same_shape\n \n \n+def xlogy(x: Tensor, y: Tensor) -> Tensor:\n+    \"\"\"Computes x * log(y). Returns 0 if x=0\"\"\"\n+    res = x * torch.log(y)\n+    res[x == 0] = 0.0\n+    return res\n+\n+\n def _tweedie_deviance_score_update(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tuple[Tensor, Tensor]:\n     \"\"\"Updates and returns variables required to compute Deviance Score for the given power. Checks for same shape\n     of input tensors.\n@@ -50,7 +57,7 @@\n                 f\"For power={power}, 'preds' has to be strictly positive and 'targets' cannot be negative.\"\n             )\n \n-        deviance_score = 2 * (targets * torch.log(targets / preds) + preds - targets)\n+        deviance_score = 2 * (xlogy(targets, targets / preds) + preds - targets)\n     elif power == 2:\n         # Gamma distribution\n         if torch.any(preds <= 0) or torch.any(targets <= 0):\n", "issue": "TweedieDevianceScore producing nan results when setting power=1.0\n## \ud83d\udc1b Bug\r\n\r\n<!-- A clear and concise description of what the bug is. -->\r\n\r\n### To Reproduce\r\n\r\n```>>> td=TweedieDevianceScore(power=1.0)\r\n>>> targets=torch.tensor([0,1,0,1])\r\n>>> preds=torch.tensor([0.1,0.1,0.1,0.1])\r\n>>> td(preds,targets)\r\ntensor(nan)\r\n>>> td=TweedieDevianceScore(power=1.0001)\r\n>>> td(preds,targets)\r\ntensor(1.5038)```\r\n\r\nI assume this is a bug since the documentation says targets >= 0 (obviously Poisson data will often be 0). \n", "before_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Tuple\n\nimport torch\nfrom torch import Tensor\n\nfrom torchmetrics.utilities.checks import _check_same_shape\n\n\ndef _tweedie_deviance_score_update(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tuple[Tensor, Tensor]:\n    \"\"\"Updates and returns variables required to compute Deviance Score for the given power. Checks for same shape\n    of input tensors.\n\n    Args:\n        preds: Predicted tensor\n        targets: Ground truth tensor\n        power: see :func:`tweedie_deviance_score`\n\n    Example:\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> _tweedie_deviance_score_update(preds, targets, power=2)\n        (tensor(4.8333), tensor(4))\n    \"\"\"\n    _check_same_shape(preds, targets)\n\n    zero_tensor = torch.zeros(preds.shape, device=preds.device)\n\n    if 0 < power < 1:\n        raise ValueError(f\"Deviance Score is not defined for power={power}.\")\n\n    if power == 0:\n        deviance_score = torch.pow(targets - preds, exponent=2)\n    elif power == 1:\n        # Poisson distribution\n        if torch.any(preds <= 0) or torch.any(targets < 0):\n            raise ValueError(\n                f\"For power={power}, 'preds' has to be strictly positive and 'targets' cannot be negative.\"\n            )\n\n        deviance_score = 2 * (targets * torch.log(targets / preds) + preds - targets)\n    elif power == 2:\n        # Gamma distribution\n        if torch.any(preds <= 0) or torch.any(targets <= 0):\n            raise ValueError(f\"For power={power}, both 'preds' and 'targets' have to be strictly positive.\")\n\n        deviance_score = 2 * (torch.log(preds / targets) + (targets / preds) - 1)\n    else:\n        if power < 0:\n            if torch.any(preds <= 0):\n                raise ValueError(f\"For power={power}, 'preds' has to be strictly positive.\")\n        elif 1 < power < 2:\n            if torch.any(preds <= 0) or torch.any(targets < 0):\n                raise ValueError(\n                    f\"For power={power}, 'targets' has to be strictly positive and 'preds' cannot be negative.\"\n                )\n        else:\n            if torch.any(preds <= 0) or torch.any(targets <= 0):\n                raise ValueError(f\"For power={power}, both 'preds' and 'targets' have to be strictly positive.\")\n\n        term_1 = torch.pow(torch.max(targets, zero_tensor), 2 - power) / ((1 - power) * (2 - power))\n        term_2 = targets * torch.pow(preds, 1 - power) / (1 - power)\n        term_3 = torch.pow(preds, 2 - power) / (2 - power)\n        deviance_score = 2 * (term_1 - term_2 + term_3)\n\n    sum_deviance_score = torch.sum(deviance_score)\n    num_observations = torch.tensor(torch.numel(deviance_score), device=preds.device)\n\n    return sum_deviance_score, num_observations\n\n\ndef _tweedie_deviance_score_compute(sum_deviance_score: Tensor, num_observations: Tensor) -> Tensor:\n    \"\"\"Computes Deviance Score.\n\n    Args:\n        sum_deviance_score: Sum of deviance scores accumalated until now.\n        num_observations: Number of observations encountered until now.\n\n    Example:\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=2)\n        >>> _tweedie_deviance_score_compute(sum_deviance_score, num_observations)\n        tensor(1.2083)\n    \"\"\"\n\n    return sum_deviance_score / num_observations\n\n\ndef tweedie_deviance_score(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tensor:\n    r\"\"\"\n    Computes the `Tweedie Deviance Score`_ between targets and predictions:\n\n    .. math::\n        deviance\\_score(\\hat{y},y) =\n        \\begin{cases}\n        (\\hat{y} - y)^2, & \\text{for }power=0\\\\\n        2 * (y * log(\\frac{y}{\\hat{y}}) + \\hat{y} - y),  & \\text{for }power=1\\\\\n        2 * (log(\\frac{\\hat{y}}{y}) + \\frac{y}{\\hat{y}} - 1),  & \\text{for }power=2\\\\\n        2 * (\\frac{(max(y,0))^{2}}{(1 - power)(2 - power)} - \\frac{y(\\hat{y})^{1 - power}}{1 - power} + \\frac{(\\hat{y})\n            ^{2 - power}}{2 - power}), & \\text{otherwise}\n        \\end{cases}\n\n    where :math:`y` is a tensor of targets values, and :math:`\\hat{y}` is a tensor of predictions.\n\n    Args:\n        preds: Predicted tensor with shape ``(N,...)``\n        targets: Ground truth tensor with shape ``(N,...)``\n        power:\n            - power < 0 : Extreme stable distribution. (Requires: preds > 0.)\n            - power = 0 : Normal distribution. (Requires: targets and preds can be any real numbers.)\n            - power = 1 : Poisson distribution. (Requires: targets >= 0 and y_pred > 0.)\n            - 1 < p < 2 : Compound Poisson distribution. (Requires: targets >= 0 and preds > 0.)\n            - power = 2 : Gamma distribution. (Requires: targets > 0 and preds > 0.)\n            - power = 3 : Inverse Gaussian distribution. (Requires: targets > 0 and preds > 0.)\n            - otherwise : Positive stable distribution. (Requires: targets > 0 and preds > 0.)\n\n    Example:\n        >>> from torchmetrics.functional import tweedie_deviance_score\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> tweedie_deviance_score(preds, targets, power=2)\n        tensor(1.2083)\n\n    \"\"\"\n    sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=power)\n    return _tweedie_deviance_score_compute(sum_deviance_score, num_observations)\n", "path": "torchmetrics/functional/regression/tweedie_deviance.py"}], "after_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Tuple\n\nimport torch\nfrom torch import Tensor\n\nfrom torchmetrics.utilities.checks import _check_same_shape\n\n\ndef xlogy(x: Tensor, y: Tensor) -> Tensor:\n    \"\"\"Computes x * log(y). Returns 0 if x=0\"\"\"\n    res = x * torch.log(y)\n    res[x == 0] = 0.0\n    return res\n\n\ndef _tweedie_deviance_score_update(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tuple[Tensor, Tensor]:\n    \"\"\"Updates and returns variables required to compute Deviance Score for the given power. Checks for same shape\n    of input tensors.\n\n    Args:\n        preds: Predicted tensor\n        targets: Ground truth tensor\n        power: see :func:`tweedie_deviance_score`\n\n    Example:\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> _tweedie_deviance_score_update(preds, targets, power=2)\n        (tensor(4.8333), tensor(4))\n    \"\"\"\n    _check_same_shape(preds, targets)\n\n    zero_tensor = torch.zeros(preds.shape, device=preds.device)\n\n    if 0 < power < 1:\n        raise ValueError(f\"Deviance Score is not defined for power={power}.\")\n\n    if power == 0:\n        deviance_score = torch.pow(targets - preds, exponent=2)\n    elif power == 1:\n        # Poisson distribution\n        if torch.any(preds <= 0) or torch.any(targets < 0):\n            raise ValueError(\n                f\"For power={power}, 'preds' has to be strictly positive and 'targets' cannot be negative.\"\n            )\n\n        deviance_score = 2 * (xlogy(targets, targets / preds) + preds - targets)\n    elif power == 2:\n        # Gamma distribution\n        if torch.any(preds <= 0) or torch.any(targets <= 0):\n            raise ValueError(f\"For power={power}, both 'preds' and 'targets' have to be strictly positive.\")\n\n        deviance_score = 2 * (torch.log(preds / targets) + (targets / preds) - 1)\n    else:\n        if power < 0:\n            if torch.any(preds <= 0):\n                raise ValueError(f\"For power={power}, 'preds' has to be strictly positive.\")\n        elif 1 < power < 2:\n            if torch.any(preds <= 0) or torch.any(targets < 0):\n                raise ValueError(\n                    f\"For power={power}, 'targets' has to be strictly positive and 'preds' cannot be negative.\"\n                )\n        else:\n            if torch.any(preds <= 0) or torch.any(targets <= 0):\n                raise ValueError(f\"For power={power}, both 'preds' and 'targets' have to be strictly positive.\")\n\n        term_1 = torch.pow(torch.max(targets, zero_tensor), 2 - power) / ((1 - power) * (2 - power))\n        term_2 = targets * torch.pow(preds, 1 - power) / (1 - power)\n        term_3 = torch.pow(preds, 2 - power) / (2 - power)\n        deviance_score = 2 * (term_1 - term_2 + term_3)\n\n    sum_deviance_score = torch.sum(deviance_score)\n    num_observations = torch.tensor(torch.numel(deviance_score), device=preds.device)\n\n    return sum_deviance_score, num_observations\n\n\ndef _tweedie_deviance_score_compute(sum_deviance_score: Tensor, num_observations: Tensor) -> Tensor:\n    \"\"\"Computes Deviance Score.\n\n    Args:\n        sum_deviance_score: Sum of deviance scores accumalated until now.\n        num_observations: Number of observations encountered until now.\n\n    Example:\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=2)\n        >>> _tweedie_deviance_score_compute(sum_deviance_score, num_observations)\n        tensor(1.2083)\n    \"\"\"\n\n    return sum_deviance_score / num_observations\n\n\ndef tweedie_deviance_score(preds: Tensor, targets: Tensor, power: float = 0.0) -> Tensor:\n    r\"\"\"\n    Computes the `Tweedie Deviance Score`_ between targets and predictions:\n\n    .. math::\n        deviance\\_score(\\hat{y},y) =\n        \\begin{cases}\n        (\\hat{y} - y)^2, & \\text{for }power=0\\\\\n        2 * (y * log(\\frac{y}{\\hat{y}}) + \\hat{y} - y),  & \\text{for }power=1\\\\\n        2 * (log(\\frac{\\hat{y}}{y}) + \\frac{y}{\\hat{y}} - 1),  & \\text{for }power=2\\\\\n        2 * (\\frac{(max(y,0))^{2}}{(1 - power)(2 - power)} - \\frac{y(\\hat{y})^{1 - power}}{1 - power} + \\frac{(\\hat{y})\n            ^{2 - power}}{2 - power}), & \\text{otherwise}\n        \\end{cases}\n\n    where :math:`y` is a tensor of targets values, and :math:`\\hat{y}` is a tensor of predictions.\n\n    Args:\n        preds: Predicted tensor with shape ``(N,...)``\n        targets: Ground truth tensor with shape ``(N,...)``\n        power:\n            - power < 0 : Extreme stable distribution. (Requires: preds > 0.)\n            - power = 0 : Normal distribution. (Requires: targets and preds can be any real numbers.)\n            - power = 1 : Poisson distribution. (Requires: targets >= 0 and y_pred > 0.)\n            - 1 < p < 2 : Compound Poisson distribution. (Requires: targets >= 0 and preds > 0.)\n            - power = 2 : Gamma distribution. (Requires: targets > 0 and preds > 0.)\n            - power = 3 : Inverse Gaussian distribution. (Requires: targets > 0 and preds > 0.)\n            - otherwise : Positive stable distribution. (Requires: targets > 0 and preds > 0.)\n\n    Example:\n        >>> from torchmetrics.functional import tweedie_deviance_score\n        >>> targets = torch.tensor([1.0, 2.0, 3.0, 4.0])\n        >>> preds = torch.tensor([4.0, 3.0, 2.0, 1.0])\n        >>> tweedie_deviance_score(preds, targets, power=2)\n        tensor(1.2083)\n\n    \"\"\"\n    sum_deviance_score, num_observations = _tweedie_deviance_score_update(preds, targets, power=power)\n    return _tweedie_deviance_score_compute(sum_deviance_score, num_observations)\n", "path": "torchmetrics/functional/regression/tweedie_deviance.py"}]}