MCPcopy Create free account
hub / github.com/MorvanZhou/tutorials / __init__

Method __init__

theanoTUT/theano8_Layer_class.py:17–25  ·  view source on GitHub ↗
(self, inputs, in_size, out_size, activation_function=None)

Source from the content-addressed store, hash-verified

15
16class Layer(object):
17 def __init__(self, inputs, in_size, out_size, activation_function=None):
18 self.W = theano.shared(np.random.normal(0, 1, (in_size, out_size)))
19 self.b = theano.shared(np.zeros((out_size, )) + 0.1)
20 self.Wx_plus_b = T.dot(inputs, self.W) + self.b
21 self.activation_function = activation_function
22 if activation_function is None:
23 self.outputs = self.Wx_plus_b
24 else:
25 self.outputs = self.activation_function(self.Wx_plus_b)
26
27"""
28to define the layer like this:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected