MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / HiddenLayer

Class HiddenLayer

ann_class2/dropout_tensorflow.py:17–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17class HiddenLayer(object):
18 def __init__(self, M1, M2):
19 self.M1 = M1
20 self.M2 = M2
21 W = np.random.randn(M1, M2) * np.sqrt(2.0 / M1)
22 b = np.zeros(M2)
23 self.W = tf.Variable(W.astype(np.float32))
24 self.b = tf.Variable(b.astype(np.float32))
25 self.params = [self.W, self.b]
26
27 def forward(self, X):
28 return tf.nn.relu(tf.matmul(X, self.W) + self.b)
29
30
31class ANN(object):

Callers 1

fitMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected