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

Function add_layer

tensorflowTUT/tf17_dropout/full_code.py:23–35  ·  view source on GitHub ↗
(inputs, in_size, out_size, layer_name, activation_function=None, )

Source from the content-addressed store, hash-verified

21
22
23def add_layer(inputs, in_size, out_size, layer_name, activation_function=None, ):
24 # add one more layer and return the output of this layer
25 Weights = tf.Variable(tf.random_normal([in_size, out_size]))
26 biases = tf.Variable(tf.zeros([1, out_size]) + 0.1, )
27 Wx_plus_b = tf.matmul(inputs, Weights) + biases
28 # here to dropout
29 Wx_plus_b = tf.nn.dropout(Wx_plus_b, keep_prob)
30 if activation_function is None:
31 outputs = Wx_plus_b
32 else:
33 outputs = activation_function(Wx_plus_b, )
34 tf.summary.histogram(layer_name + '/outputs', outputs)
35 return outputs
36
37
38# define placeholder for inputs to network

Callers 1

full_code.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected