im2sequence的输出形状
Created by: shaoshenchen
来源: from paddle.fluid.layer import im2sequence
x.shape = [-1, 1024, 3, 32] # h=3 w=32 x = im2sequence(x, (x.shape[2], 1), (1, 1)) # filter_size=(3,1) stride=(1,1)
当使用im2sequence求x的新shape时,通过paddle提供的公式shape={input.batch_size * output_height * output_width, filter_size_height* filter_size_width * input.channels}
input_batch_size = -1 output_height = 1 + (0+0+3-3+1-1) / 1 = 1 output_width = 1 + (0+0+32-1+1-1) / 1 = 32 shape[0] = -32
但是调试时发现x的shape应该是(-1, 3072),我按照公式求解但是得到了不一样的答案,迫切希望能得到一个解答。