Skip to content
Snippets Groups Projects
Commit 7800353f authored by Tobias Rothlin's avatar Tobias Rothlin
Browse files

Added LeakyRELU Class for Exam

parent d5bc9193
No related branches found
No related tags found
No related merge requests found
import torch
class LeakyRELU:
def __init__(self):
self.x = 0
def forward(self,x):
self.x = x
if x >= 0:
y = x
elif x <= 0:
y = 0.1*x
return y
def backwards(self,dz):
if self.x >= 0:
f = 1
elif self.x < 0:
f = 0.1
return f*dz
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment