def build_step(self, signals):
j = signals.gather(self.J_data)
j -= self.one
# note: we convert all the j to be positive before this calculation
# (even though we'll only use the values that are already positive),
# otherwise we can end up with nans in the gradient
rates = self.amplitude / (
self.tau_ref + self.tau_rc * tf.log1p(tf.reciprocal(
tf.maximum(j, self.epsilon))))
signals.scatter(self.output_data, tf.where(j > self.zero, rates,
self.zeros))
评论列表
文章目录