def connect_cores(input, output_dim, name):
"""Connect two cores given the inputs, synaptic weights, and output dimension.
Inputs can be output from a previous core or spike inputs"""
input_dim = int(input.get_shape()[1])
s, axon_types, axon_weights = synapse_weight((input_dim, output_dim), name)
b = leak_bias([output_dim], name)
c = synapse_connection([input_dim, output_dim], name)
xc = tf.reshape(input, (-1, input_dim, 1)) * c
mu = b + tf.reduce_sum(xc * s, 1)
sigma2 = tf.reduce_sum(xc * (1. - xc) * tf.pow(s, 2), 1)
# Output is proba that each neuron fires
x0 = tf.zeros_like(mu)
output = normal_ccdf(x0, mu, sigma2)
return output, b, c, axon_types, axon_weights, s
评论列表
文章目录