def addlayer(inputs,insize,outsize,activity_function = None):
weights = tf.Variable(tf.random_normal([insize,outsize]))
biases = tf.Variable(tf.zeros([1,outsize])+0.1)
totle = tf.multiply(weights,inputs)+ biase
if actiactivity_function is None:
outputs = totle
else:
outputs = activity_function(totle)
return outputs
Write a function to add the network layer, easy to add just behind layers of the network.
Size insize, outsize input and output
activity_function activation function