grads = [tf.gradients(yle, x)[0] for yle in yl]
gradsp = tf.pack(grads)
gradst = tf.reshape(gradsp, shape=(shapey[0], shapey[1], shapex[0], shapex[1]))
return gradst
Градиенты Tensorflow: без автоматической неявной суммы