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

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

diff --git a/3_RNN/Initializers.py b/3_RNN/Initializers.py
new file mode 100644
index 0000000..f046fe5
--- /dev/null
+++ b/3_RNN/Initializers.py
@@ -0,0 +1,49 @@
+import numpy as np
+
+
+class Constant:
+
+    def __init__(self, constant=0.1):
+        self.constant = constant
+
+    def initialize(self, weights_shape, fan_in, fan_out):
+        output = (np.ones(weights_shape))*self.constant
+
+        return output
+
+
+class UniformRandom:
+
+    def __init__(self):
+        self.low = None
+        self.high = None
+
+    def initialize(self, weights_shape, fan_in, fan_out):
+        self.low = 0
+        self.high = 1
+        output = np.random.uniform(self.low, self.high, weights_shape)
+        return output
+
+
+class Xavier:
+
+    def __init__(self):
+        self.std = None
+
+    def initialize(self, weights_shape, fan_in, fan_out):
+        self.std = np.sqrt(2 / (fan_in + fan_out))
+        output = np.random.normal(0, self.std, weights_shape)
+
+        return output
+
+
+class He:
+
+    def __init__(self):
+        self.std = None
+
+    def initialize(self, weights_shape, fan_in, fan_out):
+        self.std = np.sqrt(2 / fan_in)
+        output = np.random.normal(0, self.std, weights_shape)
+
+        return output
-- 
GitLab