Closed BaiYu0120 closed 5 years ago
Hi. Thank you for your interest in our work. I guess you were mentioning tf.space_to_depth
. In fact, its behavior follows what we want. Note that in this implementation, the tensor has the shape [N, H, W, C]
.
You can convince yourself after trying the following snippet:
sess = tf.Session()
x = tf.constant([[[[1], [2], [5], [6]],
[[3], [4], [7], [8]],
[[9], [10], [13], [14]],
[[11], [12], [15], [16]]]])
y = tf.space_to_depth(x, 2)
print(sess.run(b[0, :,:, 0]))
# this will give you
# array([[ 1, 5],
# [ 9, 13]])
print(sess.run(b[0, :,:, 1]))
# array([[ 2, 6],
# [ 10, 14]])
Hi, I saw your code applying tf.depth_to_space to implement the desubpixel layer. I'm confused about its function.
An example as below:
For the following input of shape [1 4 4 1], and a block size of 2:
x = [[[[1], [2], [5], [6]], [[3], [4], [7], [8]], [[9], [10], [13], [14]], [[11], [12], [15], [16]]]]
the operator will return the following tensor of shape [1 2 2 4]:
x = [[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]]
but what you want is: x = [[[[1, 5, 9, 13], [2, 6, 10, 14]], [[3, 7, 11, 15], [4, 8, 12, 16]]]]
Is that correct?