Skip to content
Snippets Groups Projects
Commit 320f5dd3 authored by Falguni Ghosh's avatar Falguni Ghosh
Browse files

Upload New File

parent 210bdec9
Branches
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment