Skip to content

Commit 68f0571

Browse files
[Term Entry] PyTorch Tensor Operations: .erfinv()
* Create erfinv.md * Update erfinv.md * minor fixes * Update erfinv.md * Update erfinv.md * Update erfinv.md ---------
1 parent 8c4a21c commit 68f0571

File tree

1 file changed

+59
-0
lines changed
  • content/pytorch/concepts/tensor-operations/terms/erfinv

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
Title: '.erfinv()'
3+
Description: 'Computes the inverse error function of input.'
4+
Subjects:
5+
- 'Computer Science'
6+
- 'Machine Learning'
7+
Tags:
8+
- 'Functions'
9+
- 'Machine Learning'
10+
- 'Python'
11+
- 'Tensor'
12+
CatalogContent:
13+
- 'intro-to-py-torch-and-neural-networks'
14+
- 'paths/computer-science'
15+
---
16+
17+
In PyTorch, the **`.erfinv()`** function returns the inverse error function of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The inverse error function in the range (−1,1) is: $$erfinv(erf(x))=x$$.
18+
19+
## Syntax
20+
21+
```pseudo
22+
torch.erfinv(input, *, out=None) → Tensor
23+
```
24+
25+
Or,
26+
27+
```pseudo
28+
torch.special.erfinv(input, *, out=None) → Tensor
29+
```
30+
31+
**Parameters:**
32+
33+
- `input`: A tensor containing values in the range (-1, 1).
34+
- `out` (Optional): A tensor to store the output. If provided, the result is written to this tensor.
35+
36+
**Return value:**
37+
38+
It returns a new tensor of the same shape as the input, containing the computed inverse error function values for each corresponding element.
39+
40+
## Example
41+
42+
In this example, the inverse error function values of each tensor is computed using `.erfinv()`:
43+
44+
```py
45+
import torch
46+
47+
# Define a tensor
48+
x = torch.tensor([0, 0.5, -1.])
49+
50+
result = torch.erfinv(torch.tensor(x))
51+
52+
print(result)
53+
```
54+
55+
Here is the output:
56+
57+
```shell
58+
tensor([ 0.0000, 0.4769, -inf])
59+
```

0 commit comments

Comments
 (0)