Skip to content

Commit a77e187

Browse files
authored
[Term Entry] PyTorch Tensor Operations: .digamma()
* Create digamma entry for PyTorch * Update digamma * Update digamma * Update and rename digamma to digamma.md * Minor changes ---------
1 parent e618995 commit a77e187

File tree

1 file changed

+54
-0
lines changed
  • content/pytorch/concepts/tensor-operations/terms/digamma

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
Title: '.digamma()'
3+
Description: 'Computes the digamma function, which is the logarithmic derivative of the gamma function.'
4+
Subjects:
5+
- 'AI'
6+
- 'Data Science'
7+
Tags:
8+
- 'AI'
9+
- 'Data Types'
10+
- 'Deep Learning'
11+
- 'Functions'
12+
CatalogContent:
13+
- 'intro-to-py-torch-and-neural-networks'
14+
- 'paths/data-science'
15+
---
16+
17+
In PyTorch, the **`.digamma()`** function computes the logarithmic derivative of the gamma function, alternatively known as the digamma function. It is often used in statistical modeling, especially in variational inference and probabilistic programming.
18+
19+
## Syntax
20+
21+
```pseudo
22+
torch.digamma(input, *, out=None)
23+
```
24+
25+
**Parameters:**
26+
27+
- `input` (Tensor): The input tensor.
28+
- `out` (Tensor, optional): The output tensor to store results. Must be the same shape as `input`.
29+
30+
**Return value:**
31+
32+
Returns a tensor containing the result.
33+
34+
## Example
35+
36+
This example demonstrates the usage of the `.digamma()` function:
37+
38+
```py
39+
import torch
40+
41+
# Create a tensor
42+
x = torch.tensor([1.0, 2.0, 3.0])
43+
44+
# Compute the digamma function
45+
y = x.digamma()
46+
47+
print(y)
48+
```
49+
50+
Here is the output:
51+
52+
```shell
53+
tensor([-0.5772, 0.4228, 0.9228])
54+
```

0 commit comments

Comments
 (0)