Commit c0bc7811 authored by Mira Arabi Haddad's avatar Mira Arabi Haddad
Browse files

GROUPWORK_Fixed tanh, Finalize modules.py

parent 8c8f2b85
......@@ -169,7 +169,8 @@ class Tanh(Module):
def forward(self, input):
self.x = input
self.x = torch.tanh(self.x) # (self.x.exp() - self.x.mul(-1).exp()) / (self.x.exp() + self.x.mul(-1).exp())
# tanh = (e^x - e^(-x)) / (e^x + e^(-x))
self.x = (self.x.exp() - self.x.mul(-1).exp()) / (self.x.exp() + self.x.mul(-1).exp())
return self.x
def backward(self, gradwrtoutput):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment