Skip to content

Commit

Permalink
GeLU backward eq fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivswan committed Nov 22, 2023
1 parent 0d444e5 commit 38a966c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.0.7
* Fixed `GeLU` backward function equation.

## 1.0.6

* `Model` is subclass of `BackwardModule` for additional functionality.
Expand Down
2 changes: 1 addition & 1 deletion analogvnn/nn/activation/Gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ def backward(self, grad_output: Optional[Tensor]) -> Optional[Tensor]:

x = self.inputs
grad = (1 / 2) * (
(1 + torch.erf(x / math.sqrt(2))) + x * ((2 / math.sqrt(math.pi)) * torch.exp(-torch.pow(x, 2)))
(1 + torch.erf(x / math.sqrt(2))) + x * (math.sqrt(2 * math.pi) * torch.exp(-torch.pow(x, 2) / 2))
)
return grad_output * grad
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where = ["analogvnn"]
[project]
# $ pip install analogvnn
name = "analogvnn"
version = "1.0.6"
version = "1.0.7"
description = "A fully modular framework for modeling and optimizing analog/photonic neural networks"
readme = "README.md"
requires-python = ">=3.7"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--extra-index-url https://download.pytorch.org/whl/cu118
--extra-index-url https://download.pytorch.org/whl/cu121
torch
torchvision
torchaudio
Expand Down

0 comments on commit 38a966c

Please sign in to comment.