From 9444fc4ba2b12032de66ec1903a2c04c8fc046fb Mon Sep 17 00:00:00 2001 From: Atul Deshpande <159980686+AtulDeshpande09@users.noreply.github.com> Date: Sat, 2 Aug 2025 11:58:30 +0530 Subject: [PATCH 1/4] Create erfc.md --- .../tensor-operations/terms/erfc/erfc.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md diff --git a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md new file mode 100644 index 00000000000..eeec48e99f9 --- /dev/null +++ b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md @@ -0,0 +1,61 @@ +--- +Title: '.erfc()' +Description: 'Computes the complementary error function of input.' +Subjects: + - 'Computer Science' + - 'Machine Learning' +Tags: + - 'Functions' + - 'Machine Learning' + - 'Python' + - 'Tensor' +CatalogContent: + - 'intro-to-py-torch-and-neural-networks' + - 'paths/computer-science' +--- + +In PyTorch, The `torch.erfc()` function returns the complementary error function of input.\ +The complementary error function is defined as follows:\ +$erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$ + +## Syntax + +```pseudo +torch.erfc(input, *, out=None) → Tensor +``` + +OR + +```pseudo +torch.special.erfc(input, *, out=None) → Tensor +``` + +**Parameters:** + +- `input`: The input tensor. +- `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 complementary error function values for each corresponding element. + +## Example + +In this example, we compute the complementary error function values of each tensor using `torch.erfc()`: + +```py +import torch + +# Define a tensor +x = torch.tensor([0, -1., 10.]) + +result = torch.erfc(x) + +print(result) +``` + +Here is the output: + +```shell +tensor([ 1.0000, 1.8427, 0.0000]) +``` From c1b3641064636f48fa575781abb22522546365f3 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Mon, 4 Aug 2025 16:38:22 +0530 Subject: [PATCH 2/4] Update erfc.md --- .../concepts/tensor-operations/terms/erfc/erfc.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md index eeec48e99f9..0effb75165c 100644 --- a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md +++ b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md @@ -14,9 +14,9 @@ CatalogContent: - 'paths/computer-science' --- -In PyTorch, The `torch.erfc()` function returns the complementary error function of input.\ -The complementary error function is defined as follows:\ -$erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$ +In PyTorch, the `torch.erfc()` function returns the complementary error function of of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The complementary error function is defined as follows: + +$$erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$$ ## Syntax @@ -24,7 +24,7 @@ $erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$ torch.erfc(input, *, out=None) → Tensor ``` -OR +Or, ```pseudo torch.special.erfc(input, *, out=None) → Tensor @@ -54,8 +54,8 @@ result = torch.erfc(x) print(result) ``` -Here is the output: +The output of this code is: ```shell -tensor([ 1.0000, 1.8427, 0.0000]) +tensor([1.0000e+00, 1.8427e+00, 1.4013e-45]) ``` From 0516d478c21ecdd6029f2f6b9489085fe3936947 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Mon, 4 Aug 2025 16:39:52 +0530 Subject: [PATCH 3/4] Update erfc.md --- content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md index 0effb75165c..ad5f0ed4008 100644 --- a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md +++ b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md @@ -14,7 +14,7 @@ CatalogContent: - 'paths/computer-science' --- -In PyTorch, the `torch.erfc()` function returns the complementary error function of of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The complementary error function is defined as follows: +In PyTorch, the **`torch.erfc()`** function returns the complementary error function of of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The complementary error function is defined as follows: $$erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$$ From b164c069d063864045bd1793fa7aee065485fccf Mon Sep 17 00:00:00 2001 From: Sriparno Roy <89148144+Sriparno08@users.noreply.github.com> Date: Fri, 8 Aug 2025 14:06:55 +0530 Subject: [PATCH 4/4] Update erfc.md --- .../pytorch/concepts/tensor-operations/terms/erfc/erfc.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md index ad5f0ed4008..44c64281f32 100644 --- a/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md +++ b/content/pytorch/concepts/tensor-operations/terms/erfc/erfc.md @@ -14,7 +14,7 @@ CatalogContent: - 'paths/computer-science' --- -In PyTorch, the **`torch.erfc()`** function returns the complementary error function of of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The complementary error function is defined as follows: +In PyTorch, the **`.erfc()`** function returns the complementary error function of of each element in the input [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). The complementary error function is written as: $$erfc(x)= 1 - \frac{2}{\sqrt{\pi}}\int_0^1 e^{-t^2} dt$$ @@ -33,15 +33,15 @@ torch.special.erfc(input, *, out=None) → Tensor **Parameters:** - `input`: The input tensor. -- `out` (optional): A tensor to store the output. If provided, the result is written to this tensor. +- `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 complementary error function values for each corresponding element. +It returns a new tensor of the same shape as the input, containing the computed complementary error function values for each corresponding element. ## Example -In this example, we compute the complementary error function values of each tensor using `torch.erfc()`: +In this example, we compute the complementary error function values of each tensor using `.erfc()`: ```py import torch