From e0d8dd82dbd9662b33f67205e5e73014a907508a Mon Sep 17 00:00:00 2001
From: Falguni Ghosh <falguni.ghosh@fau.de>
Date: Sun, 15 Oct 2023 21:14:34 +0000
Subject: [PATCH] Upload New File

---
 3_RNN/ReLU.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 3_RNN/ReLU.py

diff --git a/3_RNN/ReLU.py b/3_RNN/ReLU.py
new file mode 100644
index 0000000..d3b2acf
--- /dev/null
+++ b/3_RNN/ReLU.py
@@ -0,0 +1,19 @@
+import numpy as np
+from .Base import BaseLayer
+
+
+class ReLU(BaseLayer):
+
+    def __init__(self):
+        super().__init__()
+        self.buffered_input = None
+
+    def forward(self, input_tensor):
+        self.buffered_input = input_tensor
+        input_tensor[input_tensor < 0] = 0
+        return input_tensor
+
+    def backward(self, error_tensor):
+        error_tensor[self.buffered_input <= 0] = 0
+        return error_tensor
+
-- 
GitLab