def unboxn(vin, n):
"""vin = (batch, h, w, depth), returns vout = (batch, n*h, n*w, depth), each pixel is duplicated."""
s = tf.shape(vin)
vout = tf.concat(0, [vin] * (n ** 2)) # Poor man's replacement for tf.tile (required for Adversarial Training support).
vout = tf.reshape(vout, [s[0] * (n ** 2), s[1], s[2], s[3]])
vout = tf.batch_to_space(vout, [[0, 0], [0, 0]], n)
return vout
评论列表
文章目录