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

Class HiddenLayer

rl2/atari/dqn_theano.py:211–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209 return self.f(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))
210
211class HiddenLayer:
212 def __init__(self, M1, M2, f=T.nnet.relu):
213 W = np.random.randn(M1, M2) * np.sqrt(2 / M1)
214 self.W = theano.shared(W.astype(np.float32))
215 self.b = theano.shared(np.zeros(M2).astype(np.float32))
216 self.params = [self.W, self.b]
217 self.f = f
218
219 def forward(self, X):
220 a = X.dot(self.W) + self.b
221 return self.f(a)
222
223class DQN:
224 def __init__(self, K, conv_layer_sizes, hidden_layer_sizes):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected