order = range(nCh,-1,-1) if reverse else range(nCh+1)
for dit in order:
with tf.control_dependencies([blurred[-1]]):
b1=0.5*tf.gather(blurred[-1],blurNeighbours1[dit])
b2=blurred[-1][1:,:,:]
b3=0.5*tf.gather(blurred[-1],blurNeighbours2[dit])
blurred.append(tf.concat([blurred[-1][0:1,:,:], b2+b1+b3],0))
After Change
order = range(n_ch, -1, -1) if reverse else range(n_ch + 1)
for dit in order:
with tf.control_dependencies([blurred[-1]]):
b1 = tf.gather(blurred[-1], blur_neighbours1[dit])
b2 = blurred[-1][1:, :, :]
b3 = tf.gather(blurred[-1], blur_neighbours2[dit])
blurred.append(tf.concat(
[blurred[-1][0:1, :, :], b2 + 0.5 * (b1 + b3)], 0))