PyTorch .erfinv()
Anonymous contributor
Published Aug 8, 2025
Contribute to Docs
In PyTorch, the .erfinv() function returns the inverse error function of each element in the input tensor. The inverse error function in the range (−1,1) is: $$erfinv(erf(x))=x$$.
Syntax
torch.erfinv(input, *, out=None) → Tensor
Or,
torch.special.erfinv(input, *, out=None) → Tensor
Parameters:
input: A tensor containing values in the range (-1, 1).out(Optional): A tensor to store the output. If provided, the result is written to this tensor.
Return value:
It returns a new tensor of the same shape as the input, containing the computed inverse error function values for each corresponding element.
Example
In this example, the inverse error function values of each tensor is computed using .erfinv():
import torch# Define a tensorx = torch.tensor([0, 0.5, -1.])result = torch.erfinv(torch.tensor(x))print(result)
Here is the output:
tensor([ 0.0000, 0.4769, -inf])
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn PyTorch on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn how to use PyTorch to build, train, and test artificial neural networks in this course.
- Intermediate.3 hours